* Initial release

git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@423 7ae35d74-ebe9-4afe-98af-79ac388436b8
Hamlib-1.1.1
Stéphane Fillod, F8CFE 2001-03-02 18:30:45 +00:00
rodzic 49f0c90f5d
commit c0d2cad491
6 zmienionych plików z 1165 dodań i 0 usunięć

179
icom/icall.c 100644
Wyświetl plik

@ -0,0 +1,179 @@
/*
* hamlib - (C) Frank Singleton 2000 (vk3fcs@ix.netcom.com)
*
* icall.c - Copyright (C) 2000 Stephane Fillod
* This shared library provides an API for communicating
* via serial interface to a virtual do-it-all Icom (for debug purpose)
* using the "CI-V" interface.
*
*
* $Id: icall.c,v 1.1 2001-03-02 18:30:45 f4cfe Exp $
*
*
* 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.
*
*/
#include <stdlib.h>
#include <stdio.h> /* Standard input/output definitions */
#include <string.h> /* String function definitions */
#include <unistd.h> /* UNIX standard function definitions */
#include <fcntl.h> /* File control definitions */
#include <errno.h> /* Error number definitions */
#include <termios.h> /* POSIX terminal control definitions */
#include <sys/ioctl.h>
#include <hamlib/rig.h>
#include <hamlib/riglist.h>
#include "icom.h"
#define ICALL_ALL_RX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_USB|RIG_MODE_LSB|RIG_MODE_RTTY|RIG_MODE_FM)
#define ICALL_1MHZ_TS_MODES (RIG_MODE_AM|RIG_MODE_FM)
#define ICALL_1HZ_TS_MODES (RIG_MODE_CW|RIG_MODE_USB|RIG_MODE_LSB|RIG_MODE_RTTY)
/* tx doesn't have WFM.
* 100W in all modes but AM (40W)
*/
#define ICALL_OTHER_TX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_USB|RIG_MODE_LSB|RIG_MODE_RTTY|RIG_MODE_FM)
#define ICALL_AM_TX_MODES (RIG_MODE_AM)
#define ICALL_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 ICALL_LEVEL_ALL (RIG_LEVEL_PREAMP|RIG_LEVEL_ATT|RIG_LEVEL_AGC|RIG_LEVEL_SQLSTAT|RIG_LEVEL_STRENGTH)
/*
*/
const struct rig_caps icall_caps = {
RIG_MODEL_ICALL, "IC-DoItAll", "Icom", "0.2", "GPL",
RIG_STATUS_ALPHA, RIG_TYPE_TRANSCEIVER,
RIG_PTT_RIG, RIG_DCD_RIG, RIG_PORT_SERIAL,
300, 19200, 8, 1, RIG_PARITY_NONE, RIG_HANDSHAKE_NONE,
0, 0, 200, 3,
ICALL_FUNC_ALL, ICALL_FUNC_ALL,
ICALL_LEVEL_ALL, RIG_LEVEL_SET(ICALL_LEVEL_ALL),
RIG_PARM_NONE, RIG_PARM_NONE, /* FIXME: parms */
icom_ctcss_list, NULL,
{ 10, RIG_DBLST_END, }, /* preamp */
{ 20, RIG_DBLST_END, },
NULL,
Hz(9999), kHz(2.1), /* RIT, IF-SHIFT */
0, /* FIXME: VFO list */
0, RIG_TRN_ON,
105, 0, 0,
/* memory channel list */
{ { 01, 99, RIG_MTYPE_MEM, 0 },
{ 100, 105, RIG_MTYPE_EDGE, 0 }, /* two by two */
{ 106, 107, RIG_MTYPE_CALL, 0 },
RIG_CHAN_END,
},
{ RIG_FRNG_END, }, /* FIXME: enter region 1 setting */
{ RIG_FRNG_END, },
{ {kHz(30),MHz(200)-1,ICALL_ALL_RX_MODES,-1,-1}, /* this trx also has UHF */
{MHz(400),MHz(470),ICALL_ALL_RX_MODES,-1,-1},
RIG_FRNG_END, },
{ {kHz(1800),MHz(2)-1,ICALL_OTHER_TX_MODES,5000,100000}, /* 100W class */
{kHz(1800),MHz(2)-1,ICALL_AM_TX_MODES,2000,40000}, /* 40W class */
{kHz(3500),MHz(4)-1,ICALL_OTHER_TX_MODES,5000,100000},
{kHz(3500),MHz(4)-1,ICALL_AM_TX_MODES,2000,40000},
{MHz(7),kHz(7300),ICALL_OTHER_TX_MODES,5000,100000},
{MHz(7),kHz(7300),ICALL_AM_TX_MODES,2000,40000},
{kHz(10100),kHz(10150),ICALL_OTHER_TX_MODES,5000,100000},
{kHz(10100),kHz(10150),ICALL_AM_TX_MODES,2000,40000},
{MHz(14),kHz(14350),ICALL_OTHER_TX_MODES,5000,100000},
{MHz(14),kHz(14350),ICALL_AM_TX_MODES,2000,40000},
{kHz(18068),kHz(18168),ICALL_OTHER_TX_MODES,5000,100000},
{kHz(18068),kHz(18168),ICALL_AM_TX_MODES,2000,40000},
{MHz(21),kHz(21450),ICALL_OTHER_TX_MODES,5000,100000},
{MHz(21),kHz(21450),ICALL_AM_TX_MODES,2000,40000},
{kHz(24890),kHz(24990),ICALL_OTHER_TX_MODES,5000,100000},
{kHz(24890),kHz(24990),ICALL_AM_TX_MODES,2000,40000},
{MHz(28),kHz(29700),ICALL_OTHER_TX_MODES,5000,100000},
{MHz(28),kHz(29700),ICALL_AM_TX_MODES,2000,40000},
{MHz(50),MHz(54),ICALL_OTHER_TX_MODES,5000,100000},
{MHz(50),MHz(54),ICALL_AM_TX_MODES,2000,40000},
{MHz(144),MHz(148),ICALL_OTHER_TX_MODES,5000,50000}, /* 50W */
{MHz(144),MHz(148),ICALL_AM_TX_MODES,2000,20000}, /* AM VHF is 20W */
{MHz(430),MHz(450),ICALL_OTHER_TX_MODES,5000,20000},
{MHz(430),MHz(450),ICALL_AM_TX_MODES,2000,8000},
RIG_FRNG_END, },
{{ICALL_1HZ_TS_MODES,1},
{ICALL_ALL_RX_MODES,10},
{ICALL_ALL_RX_MODES,100},
{ICALL_ALL_RX_MODES,kHz(1)},
{ICALL_ALL_RX_MODES,kHz(5)},
{ICALL_ALL_RX_MODES,kHz(9)},
{ICALL_ALL_RX_MODES,kHz(10)},
{ICALL_ALL_RX_MODES,12500},
{ICALL_ALL_RX_MODES,kHz(20)},
{ICALL_ALL_RX_MODES,kHz(25)},
{ICALL_ALL_RX_MODES,kHz(100)},
{ICALL_1MHZ_TS_MODES,MHz(1)},
RIG_TS_END,
},
/* mode/filter list, remember: order matters! */
{
{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,
},
NULL, /* priv */
icom_init, icom_cleanup, NULL, NULL, NULL /* probe not supported yet */,
icom_set_freq, icom_get_freq, icom_set_mode, icom_get_mode, icom_set_vfo,
NULL,
/*
* FIXME:
* the use of the following GNU extension (field: value)
* is bad manner in portable code but admit it, quite handy
* when testing stuff. --SF
*/
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_channel: icom_set_channel,
get_channel: icom_get_channel,
set_mem: icom_set_mem,
mv_ctl: icom_mv_ctl,
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_split_freq: icom_set_split_freq,
get_split_freq: icom_get_split_freq,
set_split: icom_set_split,
get_split: icom_get_split,
set_ctcss: icom_set_ctcss,
get_ctcss: icom_get_ctcss,
set_ctcss_sql: icom_set_ctcss_sql,
get_ctcss_sql: icom_get_ctcss_sql,
};
/*
* Function definitions below
*/

6
pcr/Makefile.am 100644
Wyświetl plik

@ -0,0 +1,6 @@
lib_LTLIBRARIES = libhamlib-pcr.la
libhamlib_pcr_la_SOURCES = pcr.c pcr1000.c
libhamlib_pcr_la_LDFLAGS = -avoid-version # -module
lib_LIBRARIES = libhamlib-pcr.a
libhamlib_pcr_a_SOURCES = pcr.c pcr1000.c
noinst_HEADERS = pcr.h

399
pcr/Makefile.in 100644
Wyświetl plik

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

411
pcr/pcr.c 100644
Wyświetl plik

@ -0,0 +1,411 @@
/*
* hamlib - (C) Frank Singleton 2000 (vk3fcs@ix.netcom.com)
*
* pcr.c - Copyright (C) 2001 Stephane Fillod
* This shared library provides an API for communicating
* via serial interface to an Icom PCR-1xxx radio.
*
*
* $Id: pcr.c,v 1.1 2001-03-02 18:26:18 f4cfe Exp $
*
*
*
* 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.
*
*/
#include <stdlib.h>
#include <stdio.h> /* Standard input/output definitions */
#include <string.h> /* String function definitions */
#include <unistd.h> /* UNIX standard function definitions */
#include <fcntl.h> /* File control definitions */
#include <errno.h> /* Error number definitions */
#include <termios.h> /* POSIX terminal control definitions */
#include <sys/ioctl.h>
#include <math.h>
#include <hamlib/rig.h>
#include <hamlib/riglist.h>
#include <serial.h>
#include <misc.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 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'
#define CRLF "\r"
#define EOM CRLF
/* as returned by GE? */
#define COUNTRY_JAPAN 0x08
#define COUNTRY_USA 0x01
#define COUNTRY_EUAUCA 0x0a
#define COUNTRY_FGA 0x0b
#define COUNTRY_DEN 0x0c
/* 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!
*/
const int pcr1_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,
};
/*
* pcr_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 pcr_transaction(RIG *rig, const char *cmd, int cmd_len, char *data, int *data_len)
{
int i;
struct rig_state *rs;
rs = &rig->state;
write_block(rs->fd, cmd, cmd_len, rs->write_delay, rs->post_write_delay);
/*
* buffered read are quite helpful here!
* However, an automate with a state model would be more efficient..
*/
i = 0;
do {
fread_block(rs->stream, data+i, 1, rs->timeout);
} while (data[i++] != ';');
*data_len = i;
return i;
}
/*
* 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;
}
/*
* FIXME: how can we retrieve current status?
*/
priv->last_freq = MHz(145);
priv->last_mode = MD_FM;
priv->last_filter = FLT_15kHz;
rig->state.priv = (void*)priv;
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;
if (rig->state.priv)
free(rig->state.priv);
rig->state.priv = NULL;
return RIG_OK;
}
/*
* pcr_set_freq
* Assumes rig!=NULL
*/
int pcr_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
{
struct pcr_priv_data *priv;
unsigned char freqbuf[32], ackbuf[16];
int freq_len,ack_len;
priv = (struct pcr_priv_data *)rig->state.priv;
freq_len = sprintf(freqbuf,"K0%010Ld0%c0%c00" CRLF, freq,
priv->last_mode, priv->last_filter);
pcr_transaction (rig, freqbuf, freq_len, ackbuf, &ack_len);
if (ack_len != 6) {
rig_debug(RIG_DEBUG_ERR,"pcr_set_freq: ack NG, len=%d\n",
ack_len);
return -RIG_ERJCTED;
}
priv->last_freq = freq;
return RIG_OK;
}
/*
* hack! pcr_get_freq
* Assumes rig!=NULL, freq!=NULL
*/
int pcr_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
{
struct pcr_priv_data *priv;
priv = (struct pcr_priv_data *)rig->state.priv;
*freq = priv->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;
unsigned char mdbuf[32],ackbuf[16];
int mdbuf_len, ack_len;
int pcrmode, pcrfilter;
priv = (struct pcr_priv_data *)rig->state.priv;
/*
* 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; pcrfilter = FLT_2_8kHz; break;
case RIG_MODE_USB: pcrmode = MD_USB; pcrfilter = FLT_2_8kHz; break;
case RIG_MODE_LSB: pcrmode = MD_LSB; pcrfilter = FLT_2_8kHz; break;
case RIG_MODE_AM: pcrmode = MD_AM; pcrfilter = FLT_15kHz; break;
case RIG_MODE_FM:
pcrmode = MD_FM;
switch (width) {
case RIG_PASSBAND_NORMAL: pcrfilter = FLT_6kHz; break;
case RIG_PASSBAND_NARROW: pcrfilter = FLT_15kHz; break;
case RIG_PASSBAND_WIDE:
pcrmode = MD_WFM;
pcrfilter = FLT_50kHz;
break;
default:
rig_debug(RIG_DEBUG_ERR,"pcr_set_mode: unsupported "
"width %d\n", width);
return -RIG_EINVAL;
}
break;
default:
rig_debug(RIG_DEBUG_ERR,"pcr_set_mode: unsupported mode %d\n",
mode);
return -RIG_EINVAL;
}
mdbuf_len = sprintf(mdbuf,"K0%010Ld0%c0%c00" CRLF, priv->last_freq,
pcrmode, pcrfilter);
pcr_transaction (rig, mdbuf, mdbuf_len, ackbuf, &ack_len);
if (ack_len != 6) {
rig_debug(RIG_DEBUG_ERR,"pcr_set_mode: ack NG, len=%d\n",
ack_len);
return -RIG_ERJCTED;
}
priv->last_mode = pcrmode;
priv->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;
priv = (struct pcr_priv_data *)rig->state.priv;
*width = RIG_PASSBAND_NORMAL;
switch (priv->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_FM;
*width = RIG_PASSBAND_WIDE;
break;
case MD_FM:
*mode = RIG_MODE_FM;
switch(priv->last_filter) {
case FLT_2_8kHz:
case FLT_6kHz: *width = RIG_PASSBAND_NARROW; break;
case FLT_15kHz: *width = RIG_PASSBAND_NORMAL; break;
case FLT_50kHz:
case FLT_230kHz: *width = RIG_PASSBAND_WIDE; break;
default:
rig_debug(RIG_DEBUG_ERR,"pcr_get_mode: unsupported "
"width %d\n", priv->last_filter);
return -RIG_EINVAL;
}
break;
default:
rig_debug(RIG_DEBUG_ERR,"pcr_get_mode: unsupported mode %d\n",
priv->last_mode);
return -RIG_EINVAL;
}
return RIG_OK;
}
/*
* pcr_get_info
* Assumes rig!=NULL
*/
unsigned char *pcr_get_info(RIG *rig)
{
struct pcr_priv_data *priv;
unsigned char ackbuf[16];
static char buf[100]; /* FIXME: reentrancy */
int ack_len;
int proto_version = 0, frmwr_version = 0;
int options = 0, country_code = 0;
char *country;
priv = (struct pcr_priv_data *)rig->state.priv;
/*
* protocol version
*/
pcr_transaction (rig, "G2?" CRLF, 5, ackbuf, &ack_len);
if (ack_len != 6) {
rig_debug(RIG_DEBUG_ERR,"pcr_get_info: ack NG, len=%d\n",
ack_len);
}
sscanf(ackbuf, "G2%d", &proto_version);
/*
* Firmware version
*/
pcr_transaction (rig, "G4?" CRLF, 5, ackbuf, &ack_len);
if (ack_len != 6) {
rig_debug(RIG_DEBUG_ERR,"pcr_get_info: ack NG, len=%d\n",
ack_len);
}
sscanf(ackbuf, "G4%d", &frmwr_version);
/*
* optional devices
*/
pcr_transaction (rig, "GD?" CRLF, 5, ackbuf, &ack_len);
if (ack_len != 6) {
rig_debug(RIG_DEBUG_ERR,"pcr_get_info: ack NG, len=%d\n",
ack_len);
}
sscanf(ackbuf, "GD%d", &options);
/*
* Country
*/
pcr_transaction (rig, "GE?" CRLF, 5, ackbuf, &ack_len);
if (ack_len != 6) {
rig_debug(RIG_DEBUG_ERR,"pcr_get_info: ack NG, len=%d\n",
ack_len);
}
sscanf(ackbuf, "GE%d", &country_code);
switch (country_code) {
case COUNTRY_JAPAN: country = "Japan"; break;
case COUNTRY_USA: country = "USA"; break;
case COUNTRY_EUAUCA: country = "Europe/Australia/Canada"; break;
case COUNTRY_FGA: country = "FGA?"; break;
case COUNTRY_DEN: country = "DEN?"; break;
default:
country = "Other";
rig_debug(RIG_DEBUG_ERR,"pcr_get_info: unknown country code %#x, "
"please retport to Hamlib maintainer\n",
country_code);
}
sprintf(buf, "Firmware v%d.%d, Protocol v%d.%d, "
"Optional devices:%s%s%s, Country: %s, ",
frmwr_version/10,frmwr_version%10,
proto_version/10,proto_version%10,
options&OPT_UT106 ? " DSP" : "",
options&OPT_UT107 ? " DARC" : "",
options ? "" : " none",
country);
return buf;
}
/*
* init_pcr is called by rig_backend_load
*/
int init_pcr(void *be_handle)
{
rig_debug(RIG_DEBUG_VERBOSE, "pcr: _init called\n");
rig_register(&pcr1000_caps);
return RIG_OK;
}

56
pcr/pcr.h 100644
Wyświetl plik

@ -0,0 +1,56 @@
/*
* hamlib - (C) Frank Singleton 2000 (vk3fcs@ix.netcom.com)
*
* pcr.h - Copyright (C) 2001 Stephane Fillod
* This shared library provides an API for communicating
* via serial interface to an ICOM using the "CI-V" interface.
*
*
* $Id: pcr.h,v 1.1 2001-03-02 18:26:18 f4cfe Exp $
*
*
* 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.
*
*/
#ifndef _PCR_H
#define _PCR_H 1
#include <hamlib/rig.h>
struct pcr_priv_data {
freq_t last_freq;
rmode_t last_mode;
int last_filter;
};
extern const int pcr1_ctcss_list[];
int pcr_init(RIG *rig);
int pcr_cleanup(RIG *rig);
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);
unsigned char *pcr_get_info(RIG *rig);
extern const struct rig_caps pcr1000_caps;
extern int init_icom(void *be_handle);
#endif /* _PCR_H */

114
pcr/pcr1000.c 100644
Wyświetl plik

@ -0,0 +1,114 @@
/*
* hamlib - (C) Frank Singleton 2000 (vk3fcs@ix.netcom.com)
*
* pcr1000.c - Copyright (C) 2001 Stephane Fillod
* This shared library provides an API for communicating
* via serial interface to an Icom PCR-1000.
*
*
* $Id: pcr1000.c,v 1.1 2001-03-02 18:26:18 f4cfe Exp $
*
*
* 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.
*
*/
#include <stdlib.h>
#include <stdio.h> /* Standard input/output definitions */
#include <string.h> /* String function definitions */
#include <unistd.h> /* UNIX standard function definitions */
#include <fcntl.h> /* File control definitions */
#include <errno.h> /* Error number definitions */
#include <termios.h> /* POSIX terminal control definitions */
#include <sys/ioctl.h>
#include <hamlib/rig.h>
#include <hamlib/riglist.h>
#include "pcr.h"
#define PCR1000_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_USB|RIG_MODE_LSB|RIG_MODE_FM|RIG_MODE_WFM)
#define PCR1000_FUNC (RIG_FUNC_FAGC|RIG_FUNC_NB|RIG_FUNC_TSQL|RIG_FUNC_ANF|RIG_FUNC_NR)
#define PCR1000_LEVEL (RIG_LEVEL_ATT|RIG_LEVEL_AGC|RIG_LEVEL_SQL|RIG_LEVEL_SQLSTAT|RIG_LEVEL_AF|RIG_LEVEL_STRENGTH)
/*
* IC PCR1000 rigs capabilities.
*/
const struct rig_caps pcr1000_caps = {
RIG_MODEL_PCR1000, "IC-PCR1000", "Icom", "0.1", "GPL",
RIG_STATUS_UNTESTED, RIG_TYPE_PCRECEIVER,
RIG_PTT_NONE, RIG_DCD_RIG, RIG_PORT_SERIAL,
300, 38400, 8, 1, RIG_PARITY_NONE, RIG_HANDSHAKE_NONE,
0, 0, 200, 3,
RIG_FUNC_NONE, PCR1000_FUNC, PCR1000_LEVEL, RIG_LEVEL_SET(PCR1000_LEVEL),
RIG_PARM_NONE, RIG_PARM_NONE, /* FIXME: parms */
pcr1_ctcss_list, NULL,
{ RIG_DBLST_END, },
{ 20, RIG_DBLST_END, }, /* attenuator */
"0123456789ABCDEF",
Hz(0), kHz(1.2), /* RIT, IF-SHIFT */
0, /* FIXME: VFO list */
0, RIG_TRN_ON,
0, 0, 0,
{ RIG_CHAN_END, }, /* no memory channel list: this is a PC receiver */
{ RIG_FRNG_END, }, /* FIXME: enter region 1 setting */
{ RIG_FRNG_END, },
{ {kHz(100),MHz(824)-10,PCR1000_MODES,-1,-1},
{MHz(849)+10,MHz(869)-10,PCR1000_MODES,-1,-1},
{MHz(894)+10,GHz(1.3)-10,PCR1000_MODES,-1,-1},
RIG_FRNG_END, },
{ RIG_FRNG_END, }, /* no TX ranges, this is a receiver */
{ { PCR1000_MODES,Hz(1) },
RIG_TS_END,
},
/* mode/filter list, remember: order matters! */
{
{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_FM|RIG_MODE_AM, kHz(15)},
{RIG_MODE_WFM|RIG_MODE_FM|RIG_MODE_AM, kHz(50)},
{RIG_MODE_WFM, kHz(230)},
RIG_FLT_END,
},
NULL, /* priv */
pcr_init, pcr_cleanup, NULL, NULL, NULL /* probe not supported yet */,
pcr_set_freq, pcr_get_freq, pcr_set_mode, pcr_get_mode,
NULL,
get_info: pcr_get_info,
/*
* TODO:
* set_trn, set_powerstat,
* set_level AF,SQL,IF,AF,ATT
* set_func: AGC,NB,TSQL, VSC?
* get_level, get_dcd, dtmf, ..
* decode_event, set_ctcss, set_ctcss_sql
* and also all the associated get_ functions.
*/
};
/*
* Function definitions below
*/