summaryrefslogtreecommitdiffstats
path: root/hdlcutil
diff options
context:
space:
mode:
Diffstat (limited to 'hdlcutil')
-rw-r--r--hdlcutil/Makefile.am35
-rw-r--r--hdlcutil/Makefile.in215
-rw-r--r--hdlcutil/fl/Makefile.am13
-rw-r--r--hdlcutil/fl/Makefile.in334
-rw-r--r--hdlcutil/fl/xfhdlcchpar.cxx73
-rw-r--r--hdlcutil/fl/xfhdlcchpar.h25
-rw-r--r--hdlcutil/fl/xfhdlcchpar_main.cxx136
-rw-r--r--hdlcutil/fl/xfhdlcst.cxx160
-rw-r--r--hdlcutil/fl/xfhdlcst.h31
-rw-r--r--hdlcutil/fl/xfhdlcst_main.cxx177
-rw-r--r--hdlcutil/fl/xfsmdiag.cxx124
-rw-r--r--hdlcutil/fl/xfsmdiag.h32
-rw-r--r--hdlcutil/fl/xfsmdiag_main.cxx412
-rw-r--r--hdlcutil/fl/xfsmdiag_main.h70
-rw-r--r--hdlcutil/fl/xfsmmixer.cxx437
-rw-r--r--hdlcutil/fl/xfsmmixer.h79
-rw-r--r--hdlcutil/fl/xfsmmixer_main.cxx462
-rw-r--r--hdlcutil/hdrvcomm.c146
-rw-r--r--hdlcutil/hdrvcomm.h9
-rw-r--r--hdlcutil/setcrystal.c140
-rw-r--r--hdlcutil/sethdlc.c13
-rw-r--r--hdlcutil/smdiag.878
-rw-r--r--hdlcutil/smdiag.c431
-rw-r--r--hdlcutil/smmixer.c10
24 files changed, 3356 insertions, 286 deletions
diff --git a/hdlcutil/Makefile.am b/hdlcutil/Makefile.am
index 3584a38..19e06b5 100644
--- a/hdlcutil/Makefile.am
+++ b/hdlcutil/Makefile.am
@@ -1,24 +1,27 @@
-installconf:
+if HAVE_X
+X11_bin_programs = smdiag
+endif
-sbin_PROGRAMS = setcrystal sethdlc smmixer
+if HAVE_FLTK
+SUBDIRS = fl
+endif
-man_MANS = sethdlc.8 smmixer.8 baycom.9 hdlcdrv.9 soundmodem.9
+bin_PROGRAMS = sethdlc smmixer $(X11_bin_programs)
-EXTRA_DIST = $(man_MANS)
+sethdlc_SOURCES = sethdlc.c hdrvcomm.c hdrvcomm.h usersmdiag.h
+smmixer_SOURCES = smmixer.c hdrvcomm.c hdrvcomm.h usersmdiag.h
+smdiag_SOURCES = smdiag.c hdrvcomm.c hdrvcomm.h usersmdiag.h
-setcrystal_SOURCES = \
- setcrystal.c
+smdiag_LDADD = $(X_LIBS) -lX11 $(X_EXTRA_LIBS)
-sethdlc_SOURCES = \
- sethdlc.c \
- hdrvcomm.c \
- hdrvcomm.h \
- usersmdiag.h
+INCLUDES = -DAX25_SYSCONFDIR=\""$(AX25_SYSCONFDIR)"\" \
+ -DAX25_LOCALSTATEDIR=\""$(AX25_LOCALSTATEDIR)"\"
-smmixer_SOURCES = \
- smmixer.c \
- hdrvcomm.c \
- hdrvcomm.h \
- usersmdiag.h
+AX25_SYSCONFDIR=$(sysconfdir)/ax25/
+AX25_LOCALSTATEDIR=$(localstatedir)/ax25/
+
+man_MANS = sethdlc.8 smmixer.8 baycom.9 hdlcdrv.9 soundmodem.9 smdiag.8
+
+EXTRA_DIST = $(man_MANS)
diff --git a/hdlcutil/Makefile.in b/hdlcutil/Makefile.in
index 555b55b..1949033 100644
--- a/hdlcutil/Makefile.in
+++ b/hdlcutil/Makefile.in
@@ -61,7 +61,9 @@ AWK = @AWK@
AX25IO_LIB = @AX25IO_LIB@
AX25_LIB = @AX25_LIB@
CC = @CC@
+CXX = @CXX@
DMASCC = @DMASCC@
+FLTK_LIB = @FLTK_LIB@
MAKEINFO = @MAKEINFO@
NCURSES_LIB = @NCURSES_LIB@
PACKAGE = @PACKAGE@
@@ -69,34 +71,41 @@ UTIL_LIB = @UTIL_LIB@
VERSION = @VERSION@
Z_LIB = @Z_LIB@
-sbin_PROGRAMS = setcrystal sethdlc smmixer
+@HAVE_X_TRUE@X11_bin_programs = smdiag
-man_MANS = sethdlc.8 smmixer.8 baycom.9 hdlcdrv.9 soundmodem.9
+@HAVE_FLTK_TRUE@SUBDIRS = fl
-EXTRA_DIST = $(man_MANS)
+bin_PROGRAMS = sethdlc smmixer $(X11_bin_programs)
-setcrystal_SOURCES = setcrystal.c
+sethdlc_SOURCES = sethdlc.c hdrvcomm.c hdrvcomm.h usersmdiag.h
+smmixer_SOURCES = smmixer.c hdrvcomm.c hdrvcomm.h usersmdiag.h
+smdiag_SOURCES = smdiag.c hdrvcomm.c hdrvcomm.h usersmdiag.h
+smdiag_LDADD = $(X_LIBS) -lX11 $(X_EXTRA_LIBS)
-sethdlc_SOURCES = sethdlc.c hdrvcomm.c hdrvcomm.h usersmdiag.h
+INCLUDES = -DAX25_SYSCONFDIR=\""$(AX25_SYSCONFDIR)"\" -DAX25_LOCALSTATEDIR=\""$(AX25_LOCALSTATEDIR)"\"
-smmixer_SOURCES = smmixer.c hdrvcomm.c hdrvcomm.h usersmdiag.h
+AX25_SYSCONFDIR = $(sysconfdir)/ax25/
+AX25_LOCALSTATEDIR = $(localstatedir)/ax25/
+man_MANS = sethdlc.8 smmixer.8 baycom.9 hdlcdrv.9 soundmodem.9 smdiag.8
+
+EXTRA_DIST = $(man_MANS)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../config.h
CONFIG_CLEAN_FILES =
-PROGRAMS = $(sbin_PROGRAMS)
+PROGRAMS = $(bin_PROGRAMS)
DEFS = @DEFS@ -I. -I$(srcdir) -I..
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
-setcrystal_OBJECTS = setcrystal.o
-setcrystal_LDADD = $(LDADD)
-setcrystal_DEPENDENCIES =
-setcrystal_LDFLAGS =
+X_CFLAGS = @X_CFLAGS@
+X_LIBS = @X_LIBS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
sethdlc_OBJECTS = sethdlc.o hdrvcomm.o
sethdlc_LDADD = $(LDADD)
sethdlc_DEPENDENCIES =
@@ -105,6 +114,9 @@ smmixer_OBJECTS = smmixer.o hdrvcomm.o
smmixer_LDADD = $(LDADD)
smmixer_DEPENDENCIES =
smmixer_LDFLAGS =
+smdiag_OBJECTS = smdiag.o hdrvcomm.o
+smdiag_DEPENDENCIES =
+smdiag_LDFLAGS =
CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
@@ -121,8 +133,9 @@ DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = tar
GZIP_ENV = --best
-SOURCES = $(setcrystal_SOURCES) $(sethdlc_SOURCES) $(smmixer_SOURCES)
-OBJECTS = $(setcrystal_OBJECTS) $(sethdlc_OBJECTS) $(smmixer_OBJECTS)
+DIST_SUBDIRS = fl
+SOURCES = $(sethdlc_SOURCES) $(smmixer_SOURCES) $(smdiag_SOURCES)
+OBJECTS = $(sethdlc_OBJECTS) $(smmixer_OBJECTS) $(smdiag_OBJECTS)
all: all-redirect
.SUFFIXES:
@@ -135,29 +148,29 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
-mostlyclean-sbinPROGRAMS:
+mostlyclean-binPROGRAMS:
-clean-sbinPROGRAMS:
- -test -z "$(sbin_PROGRAMS)" || rm -f $(sbin_PROGRAMS)
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
-distclean-sbinPROGRAMS:
+distclean-binPROGRAMS:
-maintainer-clean-sbinPROGRAMS:
+maintainer-clean-binPROGRAMS:
-install-sbinPROGRAMS: $(sbin_PROGRAMS)
+install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
- $(mkinstalldirs) $(DESTDIR)$(sbindir)
- @list='$(sbin_PROGRAMS)'; for p in $$list; do \
+ $(mkinstalldirs) $(DESTDIR)$(bindir)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
if test -f $$p; then \
- echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \
- $(INSTALL_PROGRAM) $$p $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \
+ $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
else :; fi; \
done
-uninstall-sbinPROGRAMS:
+uninstall-binPROGRAMS:
@$(NORMAL_UNINSTALL)
- list='$(sbin_PROGRAMS)'; for p in $$list; do \
- rm -f $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
+ list='$(bin_PROGRAMS)'; for p in $$list; do \
+ rm -f $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
done
.c.o:
@@ -179,10 +192,6 @@ distclean-compile:
maintainer-clean-compile:
-setcrystal: $(setcrystal_OBJECTS) $(setcrystal_DEPENDENCIES)
- @rm -f setcrystal
- $(LINK) $(setcrystal_LDFLAGS) $(setcrystal_OBJECTS) $(setcrystal_LDADD) $(LIBS)
-
sethdlc: $(sethdlc_OBJECTS) $(sethdlc_DEPENDENCIES)
@rm -f sethdlc
$(LINK) $(sethdlc_LDFLAGS) $(sethdlc_OBJECTS) $(sethdlc_LDADD) $(LIBS)
@@ -191,6 +200,10 @@ smmixer: $(smmixer_OBJECTS) $(smmixer_DEPENDENCIES)
@rm -f smmixer
$(LINK) $(smmixer_LDFLAGS) $(smmixer_OBJECTS) $(smmixer_LDADD) $(LIBS)
+smdiag: $(smdiag_OBJECTS) $(smdiag_DEPENDENCIES)
+ @rm -f smdiag
+ $(LINK) $(smdiag_LDFLAGS) $(smdiag_OBJECTS) $(smdiag_LDADD) $(LIBS)
+
install-man8:
$(mkinstalldirs) $(DESTDIR)$(man8dir)
@list='$(man8_MANS)'; \
@@ -263,6 +276,61 @@ uninstall-man:
@$(NORMAL_UNINSTALL)
$(MAKE) $(AM_MAKEFLAGS) uninstall-man8 uninstall-man9
+# 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.
+
+@SET_MAKE@
+
+all-recursive install-data-recursive install-exec-recursive \
+installdirs-recursive install-recursive uninstall-recursive \
+check-recursive installcheck-recursive info-recursive dvi-recursive:
+ @set fnord $(MAKEFLAGS); amf=$$2; \
+ 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; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+ @set fnord $(MAKEFLAGS); amf=$$2; \
+ dot_seen=no; \
+ rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \
+ rev="$$subdir $$rev"; \
+ test "$$subdir" = "." && dot_seen=yes; \
+ done; \
+ test "$$dot_seen" = "no" && 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; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP)
@@ -273,9 +341,14 @@ ID: $(HEADERS) $(SOURCES) $(LISP)
here=`pwd` && cd $(srcdir) \
&& mkid -f$$here/ID $$unique $(LISP)
-TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
tags=; \
here=`pwd`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
@@ -307,32 +380,43 @@ distdir: $(DISTFILES)
|| cp -p $$d/$$file $(distdir)/$$file || :; \
fi; \
done
+ for subdir in $(DIST_SUBDIRS); do \
+ if test "$$subdir" = .; then :; else \
+ test -d $(distdir)/$$subdir \
+ || mkdir $(distdir)/$$subdir \
+ || exit 1; \
+ chmod 777 $(distdir)/$$subdir; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(top_distdir) distdir=../$(distdir)/$$subdir distdir) \
+ || exit 1; \
+ fi; \
+ done
info-am:
-info: info-am
+info: info-recursive
dvi-am:
-dvi: dvi-am
+dvi: dvi-recursive
check-am: all-am
-check: check-am
+check: check-recursive
installcheck-am:
-installcheck: installcheck-am
-install-exec-am: install-sbinPROGRAMS
-install-exec: install-exec-am
+installcheck: installcheck-recursive
+install-exec-am: install-binPROGRAMS
+install-exec: install-exec-recursive
install-data-am: install-man
-install-data: install-data-am
+install-data: install-data-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-install: install-am
-uninstall-am: uninstall-sbinPROGRAMS uninstall-man
-uninstall: uninstall-am
+install: install-recursive
+uninstall-am: uninstall-binPROGRAMS uninstall-man
+uninstall: uninstall-recursive
all-am: Makefile $(PROGRAMS) $(MANS)
-all-redirect: all-am
+all-redirect: all-recursive
install-strip:
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
-installdirs:
- $(mkinstalldirs) $(DESTDIR)$(sbindir) $(DESTDIR)$(mandir)/man8 \
+installdirs: installdirs-recursive
+installdirs-am:
+ $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)/man8 \
$(DESTDIR)$(mandir)/man9
@@ -345,44 +429,47 @@ distclean-generic:
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
maintainer-clean-generic:
-mostlyclean-am: mostlyclean-sbinPROGRAMS mostlyclean-compile \
+mostlyclean-am: mostlyclean-binPROGRAMS mostlyclean-compile \
mostlyclean-tags mostlyclean-generic
-mostlyclean: mostlyclean-am
+mostlyclean: mostlyclean-recursive
-clean-am: clean-sbinPROGRAMS clean-compile clean-tags clean-generic \
+clean-am: clean-binPROGRAMS clean-compile clean-tags clean-generic \
mostlyclean-am
-clean: clean-am
+clean: clean-recursive
-distclean-am: distclean-sbinPROGRAMS distclean-compile distclean-tags \
+distclean-am: distclean-binPROGRAMS distclean-compile distclean-tags \
distclean-generic clean-am
-distclean: distclean-am
+distclean: distclean-recursive
-maintainer-clean-am: maintainer-clean-sbinPROGRAMS \
+maintainer-clean-am: maintainer-clean-binPROGRAMS \
maintainer-clean-compile maintainer-clean-tags \
maintainer-clean-generic distclean-am
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
-maintainer-clean: maintainer-clean-am
-
-.PHONY: mostlyclean-sbinPROGRAMS distclean-sbinPROGRAMS \
-clean-sbinPROGRAMS maintainer-clean-sbinPROGRAMS uninstall-sbinPROGRAMS \
-install-sbinPROGRAMS mostlyclean-compile distclean-compile \
-clean-compile maintainer-clean-compile install-man8 uninstall-man8 \
-install-man9 uninstall-man9 install-man uninstall-man tags \
-mostlyclean-tags distclean-tags clean-tags maintainer-clean-tags \
-distdir info-am info dvi-am dvi check check-am installcheck-am \
-installcheck install-exec-am install-exec install-data-am install-data \
-install-am install uninstall-am uninstall all-redirect all-am all \
+maintainer-clean: maintainer-clean-recursive
+
+.PHONY: mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \
+maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \
+mostlyclean-compile distclean-compile clean-compile \
+maintainer-clean-compile install-man8 uninstall-man8 install-man9 \
+uninstall-man9 install-man uninstall-man install-data-recursive \
+uninstall-data-recursive install-exec-recursive \
+uninstall-exec-recursive installdirs-recursive uninstalldirs-recursive \
+all-recursive check-recursive installcheck-recursive info-recursive \
+dvi-recursive mostlyclean-recursive distclean-recursive clean-recursive \
+maintainer-clean-recursive tags tags-recursive mostlyclean-tags \
+distclean-tags clean-tags maintainer-clean-tags distdir info-am info \
+dvi-am dvi check check-am installcheck-am installcheck install-exec-am \
+install-exec install-data-am install-data install-am install \
+uninstall-am uninstall all-redirect all-am all installdirs-am \
installdirs mostlyclean-generic distclean-generic clean-generic \
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
-installconf:
-
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
diff --git a/hdlcutil/fl/Makefile.am b/hdlcutil/fl/Makefile.am
new file mode 100644
index 0000000..401ef67
--- /dev/null
+++ b/hdlcutil/fl/Makefile.am
@@ -0,0 +1,13 @@
+
+sbin_PROGRAMS = xfsmmixer xfhdlcchpar xfhdlcst xfsmdiag
+
+INCLUDES = $(X_CFLAGS) -I..
+LDFLAGS = $(X_LIBS) -lX11 $(FLTK_LIB)
+LDADD = hdrvcomm.o
+
+xfsmmixer_SOURCES = xfsmmixer.cxx xfsmmixer_main.cxx xfsmmixer.h
+xfhdlcchpar_SOURCES = xfhdlcchpar.cxx xfhdlcchpar_main.cxx xfhdlcchpar.h
+xfhdlcst_SOURCES = xfhdlcst.cxx xfhdlcst_main.cxx xfhdlcst.h
+xfsmdiag_SOURCES = xfsmdiag.cxx xfsmdiag_main.cxx xfsmdiag.h xfsmdiag_main.h
+
+hdrvcomm.o: ../hdrvcomm.o
diff --git a/hdlcutil/fl/Makefile.in b/hdlcutil/fl/Makefile.in
new file mode 100644
index 0000000..109e736
--- /dev/null
+++ b/hdlcutil/fl/Makefile.in
@@ -0,0 +1,334 @@
+# 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 = :
+AWK = @AWK@
+AX25IO_LIB = @AX25IO_LIB@
+AX25_LIB = @AX25_LIB@
+CC = @CC@
+CXX = @CXX@
+DMASCC = @DMASCC@
+FLTK_LIB = @FLTK_LIB@
+MAKEINFO = @MAKEINFO@
+NCURSES_LIB = @NCURSES_LIB@
+PACKAGE = @PACKAGE@
+UTIL_LIB = @UTIL_LIB@
+VERSION = @VERSION@
+Z_LIB = @Z_LIB@
+
+sbin_PROGRAMS = xfsmmixer xfhdlcchpar xfhdlcst xfsmdiag
+
+INCLUDES = $(X_CFLAGS) -I..
+LDFLAGS = $(X_LIBS) -lX11 $(FLTK_LIB)
+LDADD = hdrvcomm.o
+
+xfsmmixer_SOURCES = xfsmmixer.cxx xfsmmixer_main.cxx xfsmmixer.h
+xfhdlcchpar_SOURCES = xfhdlcchpar.cxx xfhdlcchpar_main.cxx xfhdlcchpar.h
+xfhdlcst_SOURCES = xfhdlcst.cxx xfhdlcst_main.cxx xfhdlcst.h
+xfsmdiag_SOURCES = xfsmdiag.cxx xfsmdiag_main.cxx xfsmdiag.h xfsmdiag_main.h
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = ../../config.h
+CONFIG_CLEAN_FILES =
+PROGRAMS = $(sbin_PROGRAMS)
+
+
+DEFS = @DEFS@ -I. -I$(srcdir) -I../..
+CPPFLAGS = @CPPFLAGS@
+LIBS = @LIBS@
+X_CFLAGS = @X_CFLAGS@
+X_LIBS = @X_LIBS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+xfsmmixer_OBJECTS = xfsmmixer.o xfsmmixer_main.o
+xfsmmixer_LDADD = $(LDADD)
+xfsmmixer_DEPENDENCIES = hdrvcomm.o
+xfsmmixer_LDFLAGS =
+xfhdlcchpar_OBJECTS = xfhdlcchpar.o xfhdlcchpar_main.o
+xfhdlcchpar_LDADD = $(LDADD)
+xfhdlcchpar_DEPENDENCIES = hdrvcomm.o
+xfhdlcchpar_LDFLAGS =
+xfhdlcst_OBJECTS = xfhdlcst.o xfhdlcst_main.o
+xfhdlcst_LDADD = $(LDADD)
+xfhdlcst_DEPENDENCIES = hdrvcomm.o
+xfhdlcst_LDFLAGS =
+xfsmdiag_OBJECTS = xfsmdiag.o xfsmdiag_main.o
+xfsmdiag_LDADD = $(LDADD)
+xfsmdiag_DEPENDENCIES = hdrvcomm.o
+xfsmdiag_LDFLAGS =
+CXXFLAGS = @CXXFLAGS@
+CXXCOMPILE = $(CXX) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@
+CFLAGS = @CFLAGS@
+COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
+DIST_COMMON = Makefile.am Makefile.in
+
+
+DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
+
+TAR = tar
+GZIP_ENV = --best
+SOURCES = $(xfsmmixer_SOURCES) $(xfhdlcchpar_SOURCES) $(xfhdlcst_SOURCES) $(xfsmdiag_SOURCES)
+OBJECTS = $(xfsmmixer_OBJECTS) $(xfhdlcchpar_OBJECTS) $(xfhdlcst_OBJECTS) $(xfsmdiag_OBJECTS)
+
+all: all-redirect
+.SUFFIXES:
+.SUFFIXES: .S .c .cxx .o .s
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps hdlcutil/fl/Makefile
+
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) \
+ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
+
+
+mostlyclean-sbinPROGRAMS:
+
+clean-sbinPROGRAMS:
+ -test -z "$(sbin_PROGRAMS)" || rm -f $(sbin_PROGRAMS)
+
+distclean-sbinPROGRAMS:
+
+maintainer-clean-sbinPROGRAMS:
+
+install-sbinPROGRAMS: $(sbin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ $(mkinstalldirs) $(DESTDIR)$(sbindir)
+ @list='$(sbin_PROGRAMS)'; for p in $$list; do \
+ if test -f $$p; then \
+ echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \
+ $(INSTALL_PROGRAM) $$p $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
+ else :; fi; \
+ done
+
+uninstall-sbinPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ list='$(sbin_PROGRAMS)'; for p in $$list; do \
+ rm -f $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
+ done
+
+.c.o:
+ $(COMPILE) -c $<
+
+.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:
+
+xfsmmixer: $(xfsmmixer_OBJECTS) $(xfsmmixer_DEPENDENCIES)
+ @rm -f xfsmmixer
+ $(CXXLINK) $(xfsmmixer_LDFLAGS) $(xfsmmixer_OBJECTS) $(xfsmmixer_LDADD) $(LIBS)
+
+xfhdlcchpar: $(xfhdlcchpar_OBJECTS) $(xfhdlcchpar_DEPENDENCIES)
+ @rm -f xfhdlcchpar
+ $(CXXLINK) $(xfhdlcchpar_LDFLAGS) $(xfhdlcchpar_OBJECTS) $(xfhdlcchpar_LDADD) $(LIBS)
+
+xfhdlcst: $(xfhdlcst_OBJECTS) $(xfhdlcst_DEPENDENCIES)
+ @rm -f xfhdlcst
+ $(CXXLINK) $(xfhdlcst_LDFLAGS) $(xfhdlcst_OBJECTS) $(xfhdlcst_LDADD) $(LIBS)
+
+xfsmdiag: $(xfsmdiag_OBJECTS) $(xfsmdiag_DEPENDENCIES)
+ @rm -f xfsmdiag
+ $(CXXLINK) $(xfsmdiag_LDFLAGS) $(xfsmdiag_OBJECTS) $(xfsmdiag_LDADD) $(LIBS)
+.cxx.o:
+ $(CXXCOMPILE) -c $<
+
+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 = hdlcutil/fl
+
+distdir: $(DISTFILES)
+ @for file in $(DISTFILES); do \
+ d=$(srcdir); \
+ if test -d $$d/$$file; then \
+ cp -pr $$/$$file $(distdir)/$$file; \
+ else \
+ test -f $(distdir)/$$file \
+ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
+ || cp -p $$d/$$file $(distdir)/$$file || :; \
+ fi; \
+ done
+hdrvcomm.o: ../hdrvcomm.c ../hdrvcomm.h ../usersmdiag.h
+xfhdlcchpar.o: xfhdlcchpar.cxx xfhdlcchpar.h
+xfhdlcchpar_main.o: xfhdlcchpar_main.cxx ../hdrvcomm.h xfhdlcchpar.h
+xfhdlcst.o: xfhdlcst.cxx xfhdlcst.h
+xfhdlcst_main.o: xfhdlcst_main.cxx ../hdrvcomm.h xfhdlcst.h
+xfsmdiag.o: xfsmdiag.cxx xfsmdiag.h xfsmdiag_main.h
+xfsmdiag_main.o: xfsmdiag_main.cxx ../hdrvcomm.h xfsmdiag.h \
+ xfsmdiag_main.h
+xfsmmixer.o: xfsmmixer.cxx xfsmmixer.h
+xfsmmixer_main.o: xfsmmixer_main.cxx ../hdrvcomm.h xfsmmixer.h
+
+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-sbinPROGRAMS
+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-sbinPROGRAMS
+uninstall: uninstall-am
+all-am: Makefile $(PROGRAMS)
+all-redirect: all-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
+installdirs:
+ $(mkinstalldirs) $(DESTDIR)$(sbindir)
+
+
+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-sbinPROGRAMS mostlyclean-compile \
+ mostlyclean-tags mostlyclean-generic
+
+mostlyclean: mostlyclean-am
+
+clean-am: clean-sbinPROGRAMS clean-compile clean-tags clean-generic \
+ mostlyclean-am
+
+clean: clean-am
+
+distclean-am: distclean-sbinPROGRAMS distclean-compile distclean-tags \
+ distclean-generic clean-am
+
+distclean: distclean-am
+
+maintainer-clean-am: maintainer-clean-sbinPROGRAMS \
+ maintainer-clean-compile maintainer-clean-tags \
+ maintainer-clean-generic distclean-am
+ @echo "This command is intended for maintainers to use;"
+ @echo "it deletes files that may require special tools to rebuild."
+
+maintainer-clean: maintainer-clean-am
+
+.PHONY: mostlyclean-sbinPROGRAMS distclean-sbinPROGRAMS \
+clean-sbinPROGRAMS maintainer-clean-sbinPROGRAMS uninstall-sbinPROGRAMS \
+install-sbinPROGRAMS mostlyclean-compile distclean-compile \
+clean-compile maintainer-clean-compile tags mostlyclean-tags \
+distclean-tags clean-tags maintainer-clean-tags distdir info-am info \
+dvi-am dvi check check-am installcheck-am installcheck install-exec-am \
+install-exec install-data-am install-data install-am install \
+uninstall-am uninstall all-redirect all-am all installdirs \
+mostlyclean-generic distclean-generic clean-generic \
+maintainer-clean-generic clean mostlyclean distclean maintainer-clean
+
+
+hdrvcomm.o: ../hdrvcomm.o
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/hdlcutil/fl/xfhdlcchpar.cxx b/hdlcutil/fl/xfhdlcchpar.cxx
new file mode 100644
index 0000000..ad2b6b1
--- /dev/null
+++ b/hdlcutil/fl/xfhdlcchpar.cxx
@@ -0,0 +1,73 @@
+// generated by Fast Light User Interface Designer (fluid) version 1.00
+
+#include "xfhdlcchpar.h"
+
+Fl_Window *chpar=(Fl_Window *)0;
+
+Fl_Value_Slider *txdelay=(Fl_Value_Slider *)0;
+
+Fl_Value_Slider *txtail=(Fl_Value_Slider *)0;
+
+Fl_Value_Slider *slottime=(Fl_Value_Slider *)0;
+
+Fl_Value_Slider *ppersist=(Fl_Value_Slider *)0;
+
+Fl_Check_Button *fulldup=(Fl_Check_Button *)0;
+
+Fl_Button *quit=(Fl_Button *)0;
+
+Fl_Output *ifname=(Fl_Output *)0;
+
+Fl_Window* create_the_forms() {
+ Fl_Window* w;
+ { Fl_Window* o = chpar = new Fl_Window(390, 260, "HDLC channel parameters");
+ w = o;
+ o->box(FL_NO_BOX);
+ o->labeltype(FL_NORMAL_LABEL);
+ { Fl_Box* o = new Fl_Box(0, 0, 390, 260);
+ o->box(FL_UP_BOX);
+ }
+ { Fl_Box* o = new Fl_Box(10, 10, 370, 240);
+ o->box(FL_DOWN_BOX);
+ }
+ { Fl_Value_Slider* o = txdelay = new Fl_Value_Slider(24, 30, 341, 30, "Tx Delay (ms)");
+ o->type(3);
+ o->labelsize(8);
+ o->callback((Fl_Callback*)cb_update);
+ }
+ { Fl_Value_Slider* o = txtail = new Fl_Value_Slider(24, 80, 341, 30, "Tx Tail (ms)");
+ o->type(3);
+ o->labelsize(8);
+ o->callback((Fl_Callback*)cb_update);
+ }
+ { Fl_Value_Slider* o = slottime = new Fl_Value_Slider(24, 130, 341, 30, "Slottime (ms)");
+ o->type(3);
+ o->labelsize(8);
+ o->callback((Fl_Callback*)cb_update);
+ }
+ { Fl_Value_Slider* o = ppersist = new Fl_Value_Slider(24, 180, 341, 30, "P-Persistence");
+ o->type(3);
+ o->labelsize(8);
+ o->callback((Fl_Callback*)cb_update);
+ }
+ { Fl_Check_Button* o = fulldup = new Fl_Check_Button(20, 220, 90, 20, "Full Duplex");
+ o->down_box(FL_DIAMOND_DOWN_BOX);
+ o->selection_color(3);
+ o->callback((Fl_Callback*)cb_update);
+ }
+ { Fl_Button* o = quit = new Fl_Button(290, 220, 70, 20, "Quit");
+ o->callback((Fl_Callback*)cb_quit, (void*)(0));
+ }
+ { Fl_Box* o = new Fl_Box(150, 220, 60, 20, "Interface");
+ o->box(FL_FLAT_BOX);
+ o->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
+ }
+ { Fl_Output* o = ifname = new Fl_Output(220, 220, 60, 20);
+ o->box(FL_EMBOSSED_BOX);
+ o->selection_color(49);
+ o->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
+ }
+ o->end();
+ }
+ return w;
+}
diff --git a/hdlcutil/fl/xfhdlcchpar.h b/hdlcutil/fl/xfhdlcchpar.h
new file mode 100644
index 0000000..57109a3
--- /dev/null
+++ b/hdlcutil/fl/xfhdlcchpar.h
@@ -0,0 +1,25 @@
+// generated by Fast Light User Interface Designer (fluid) version 1.00
+
+#ifndef xfhdlcchpar_h
+#define xfhdlcchpar_h
+#include <FL/Fl.H>
+#include <FL/Fl_Window.H>
+extern Fl_Window *chpar;
+#include <FL/Fl_Box.H>
+#include <FL/Fl_Value_Slider.H>
+extern void cb_update(Fl_Widget*, void*);
+extern void cb_update(Fl_Value_Slider*, void*);
+extern Fl_Value_Slider *txdelay;
+extern Fl_Value_Slider *txtail;
+extern Fl_Value_Slider *slottime;
+extern Fl_Value_Slider *ppersist;
+#include <FL/Fl_Check_Button.H>
+extern void cb_update(Fl_Check_Button*, void*);
+extern Fl_Check_Button *fulldup;
+#include <FL/Fl_Button.H>
+extern void cb_quit(Fl_Button*, long);
+extern Fl_Button *quit;
+#include <FL/Fl_Output.H>
+extern Fl_Output *ifname;
+Fl_Window* create_the_forms();
+#endif
diff --git a/hdlcutil/fl/xfhdlcchpar_main.cxx b/hdlcutil/fl/xfhdlcchpar_main.cxx
new file mode 100644
index 0000000..443d1f3
--- /dev/null
+++ b/hdlcutil/fl/xfhdlcchpar_main.cxx
@@ -0,0 +1,136 @@
+/*****************************************************************************/
+
+/*
+ * xfhdlcchpar_main.C -- kernel hdlc radio modem driver channel parameter setting utility.
+ *
+ * Copyright (C) 1996,1997,2000 Thomas Sailer (sailer@ife.ee.ethz.ch)
+ *
+ * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * Please note that the GPL allows you to use the driver, NOT the radio.
+ * In order to use the radio, you need a license from the communications
+ * authority of your country.
+ *
+ *
+ * History:
+ * 0.1 14.12.1996 Started
+ * 0.2 11.05.1997 introduced hdrvcomm.h
+ * 0.3 05.01.2000 upgraded to fltk 1.0.7
+ */
+
+/*****************************************************************************/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+#include <sys/types.h>
+#include <net/if.h>
+#include "hdrvcomm.h"
+#include "xfhdlcchpar.h"
+
+/* ---------------------------------------------------------------------- */
+
+static char *progname;
+
+/* ---------------------------------------------------------------------- */
+
+void cb_update(Fl_Widget *widget, void *udata)
+{
+ int ret;
+ struct hdrvc_channel_params cp;
+
+ cp.tx_delay = (int)(0.1*txdelay->value());
+ cp.tx_tail = (int)(0.1*txtail->value());
+ cp.slottime = (int)(0.1*slottime->value());
+ cp.ppersist = (int)(ppersist->value());
+ cp.fulldup = !!fulldup->value();
+ ret = hdrvc_set_channel_access_param(cp);
+ if (ret < 0)
+ perror("hdrvc_set_channel_access_param");
+}
+
+/* ---------------------------------------------------------------------- */
+
+void cb_quit(Fl_Button *, long)
+{
+ exit(0);
+}
+
+/* ---------------------------------------------------------------------- */
+
+static const char *usage_str =
+"[-i smif]\n"
+" -i: specify the name of the baycom kernel driver interface\n\n";
+
+/* ---------------------------------------------------------------------- */
+
+int main(int argc, char *argv[])
+{
+ int c, i;
+ int ret;
+ struct hdrvc_channel_params cp;
+
+ progname = *argv;
+ printf("%s: Version 0.3; (C) 1996,1997,2000 by Thomas Sailer HB9JNX/AE4WA\n", progname);
+ hdrvc_args(&argc, argv, "bc0");
+ for (i = 1; i < argc; ) {
+ c = i;
+ Fl::arg(argc, argv, c);
+ if (c <= 0) {
+ i++;
+ continue;
+ }
+ memmove(&argv[i], &argv[i+c], (argc-i) * sizeof(char *));
+ argc -= c;
+ }
+#if 0
+ while ((ret = getopt(argc, argv, "")) != -1) {
+ switch (ret) {
+ default:
+ printf("usage: %s %s", progname, usage_str);
+ exit(-1);
+ }
+ }
+#endif
+ hdrvc_init();
+
+ create_the_forms();
+ ifname->value(hdrvc_ifname());
+ /*
+ * set channel params
+ */
+ ret = hdrvc_get_channel_access_param(&cp);
+ if (ret < 0) {
+ perror("hdrvc_get_channel_access_param");
+ exit(1);
+ }
+ txdelay->step(10);
+ txdelay->bounds(0, 2550);
+ txdelay->value(cp.tx_delay*10);
+ txtail->step(10);
+ txtail->bounds(0, 2550);
+ txtail->value(cp.tx_tail*10);
+ slottime->step(10);
+ slottime->bounds(0, 2550);
+ slottime->value(cp.slottime*10);
+ ppersist->step(1);
+ ppersist->bounds(0, 255);
+ ppersist->value(cp.ppersist);
+ fulldup->value(!!cp.fulldup);
+ chpar->show();
+ Fl::run();
+ exit(0);
+}
diff --git a/hdlcutil/fl/xfhdlcst.cxx b/hdlcutil/fl/xfhdlcst.cxx
new file mode 100644
index 0000000..0548bf3
--- /dev/null
+++ b/hdlcutil/fl/xfhdlcst.cxx
@@ -0,0 +1,160 @@
+// generated by Fast Light User Interface Designer (fluid) version 1.00
+
+#include "xfhdlcst.h"
+
+Fl_Window *hdlcst=(Fl_Window *)0;
+
+Fl_Round_Button *dcd=(Fl_Round_Button *)0;
+
+Fl_Round_Button *ptt=(Fl_Round_Button *)0;
+
+Fl_Output *txpacket=(Fl_Output *)0;
+
+Fl_Output *txerror=(Fl_Output *)0;
+
+Fl_Output *rxpacket=(Fl_Output *)0;
+
+Fl_Output *rxerror=(Fl_Output *)0;
+
+Fl_Output *modcyc=(Fl_Output *)0;
+
+Fl_Output *demodcyc=(Fl_Output *)0;
+
+Fl_Output *intfreq=(Fl_Output *)0;
+
+Fl_Output *dmares=(Fl_Output *)0;
+
+Fl_Box *tmodcyc=(Fl_Box *)0;
+
+Fl_Box *tdemodcyc=(Fl_Box *)0;
+
+Fl_Box *tintfreq=(Fl_Box *)0;
+
+Fl_Box *tdmares=(Fl_Box *)0;
+
+Fl_Output *modename=(Fl_Output *)0;
+
+Fl_Output *drivername=(Fl_Output *)0;
+
+Fl_Button *quit=(Fl_Button *)0;
+
+Fl_Window* create_the_forms() {
+ Fl_Window* w;
+ { Fl_Window* o = hdlcst = new Fl_Window(250, 300, "HDLC driver state");
+ w = o;
+ o->box(FL_NO_BOX);
+ { Fl_Box* o = new Fl_Box(0, 0, 250, 300);
+ o->box(FL_UP_BOX);
+ }
+ { Fl_Box* o = new Fl_Box(10, 230, 230, 60);
+ o->box(FL_DOWN_BOX);
+ }
+ { Fl_Box* o = new Fl_Box(10, 10, 230, 220);
+ o->box(FL_DOWN_BOX);
+ }
+ { Fl_Round_Button* o = dcd = new Fl_Round_Button(160, 20, 20, 20);
+ o->down_box(FL_ROUND_DOWN_BOX);
+ o->selection_color(3);
+ o->align(FL_ALIGN_CENTER);
+ }
+ { Fl_Round_Button* o = ptt = new Fl_Round_Button(160, 40, 20, 20);
+ o->down_box(FL_ROUND_DOWN_BOX);
+ o->align(FL_ALIGN_CENTER);
+ }
+ { Fl_Output* o = txpacket = new Fl_Output(160, 60, 70, 20);
+ o->box(FL_EMBOSSED_BOX);
+ o->selection_color(49);
+ o->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
+ }
+ { Fl_Output* o = txerror = new Fl_Output(160, 80, 70, 20);
+ o->box(FL_EMBOSSED_BOX);
+ o->selection_color(49);
+ o->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
+ }
+ { Fl_Output* o = rxpacket = new Fl_Output(160, 100, 70, 20);
+ o->box(FL_EMBOSSED_BOX);
+ o->selection_color(49);
+ o->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
+ }
+ { Fl_Output* o = rxerror = new Fl_Output(160, 120, 70, 20);
+ o->box(FL_EMBOSSED_BOX);
+ o->selection_color(49);
+ o->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
+ }
+ { Fl_Output* o = modcyc = new Fl_Output(160, 140, 70, 20);
+ o->box(FL_EMBOSSED_BOX);
+ o->selection_color(49);
+ o->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
+ }
+ { Fl_Output* o = demodcyc = new Fl_Output(160, 160, 70, 20);
+ o->box(FL_EMBOSSED_BOX);
+ o->selection_color(49);
+ o->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
+ }
+ { Fl_Output* o = intfreq = new Fl_Output(160, 180, 70, 20);
+ o->box(FL_EMBOSSED_BOX);
+ o->selection_color(49);
+ o->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
+ }
+ { Fl_Output* o = dmares = new Fl_Output(160, 200, 70, 20);
+ o->box(FL_EMBOSSED_BOX);
+ o->selection_color(49);
+ o->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
+ }
+ { Fl_Box* o = new Fl_Box(20, 60, 110, 20, "Transmit Packets");
+ o->box(FL_FLAT_BOX);
+ o->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
+ }
+ { Fl_Box* o = new Fl_Box(20, 80, 110, 20, "Transmit Errors");
+ o->box(FL_FLAT_BOX);
+ o->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
+ }
+ { Fl_Box* o = new Fl_Box(20, 100, 110, 20, "Receive Packets");
+ o->box(FL_FLAT_BOX);
+ o->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
+ }
+ { Fl_Box* o = new Fl_Box(20, 120, 110, 20, "Receive Errors");
+ o->box(FL_FLAT_BOX);
+ o->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
+ }
+ { Fl_Box* o = new Fl_Box(20, 40, 110, 20, "PTT");
+ o->box(FL_FLAT_BOX);
+ o->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
+ }
+ { Fl_Box* o = new Fl_Box(20, 20, 110, 20, "DCD");
+ o->box(FL_FLAT_BOX);
+ o->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
+ }
+ { Fl_Box* o = tmodcyc = new Fl_Box(20, 140, 110, 20, "Modulator Cycles");
+ o->box(FL_FLAT_BOX);
+ o->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
+ }
+ { Fl_Box* o = tdemodcyc = new Fl_Box(20, 160, 110, 20, "Demodulator Cycles");
+ o->box(FL_FLAT_BOX);
+ o->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
+ }
+ { Fl_Box* o = tintfreq = new Fl_Box(20, 180, 110, 20, "Interrupt Frequency");
+ o->box(FL_FLAT_BOX);
+ o->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
+ }
+ { Fl_Box* o = tdmares = new Fl_Box(20, 200, 110, 20, "DMA residue");
+ o->box(FL_FLAT_BOX);
+ o->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
+ }
+ { Fl_Output* o = modename = new Fl_Output(20, 240, 210, 20);
+ o->box(FL_EMBOSSED_BOX);
+ o->selection_color(49);
+ o->align(FL_ALIGN_CENTER|FL_ALIGN_INSIDE);
+ }
+ { Fl_Output* o = drivername = new Fl_Output(20, 260, 210, 20);
+ o->box(FL_EMBOSSED_BOX);
+ o->selection_color(49);
+ o->align(FL_ALIGN_CENTER|FL_ALIGN_INSIDE);
+ }
+ { Fl_Button* o = quit = new Fl_Button(190, 20, 40, 30, "Quit");
+ o->callback((Fl_Callback*)cb_quit, (void*)(0));
+ }
+ o->end();
+ }
+ return w;
+}
diff --git a/hdlcutil/fl/xfhdlcst.h b/hdlcutil/fl/xfhdlcst.h
new file mode 100644
index 0000000..0d70e48
--- /dev/null
+++ b/hdlcutil/fl/xfhdlcst.h
@@ -0,0 +1,31 @@
+// generated by Fast Light User Interface Designer (fluid) version 1.00
+
+#ifndef xfhdlcst_h
+#define xfhdlcst_h
+#include <FL/Fl.H>
+#include <FL/Fl_Window.H>
+extern Fl_Window *hdlcst;
+#include <FL/Fl_Box.H>
+#include <FL/Fl_Round_Button.H>
+extern Fl_Round_Button *dcd;
+extern Fl_Round_Button *ptt;
+#include <FL/Fl_Output.H>
+extern Fl_Output *txpacket;
+extern Fl_Output *txerror;
+extern Fl_Output *rxpacket;
+extern Fl_Output *rxerror;
+extern Fl_Output *modcyc;
+extern Fl_Output *demodcyc;
+extern Fl_Output *intfreq;
+extern Fl_Output *dmares;
+extern Fl_Box *tmodcyc;
+extern Fl_Box *tdemodcyc;
+extern Fl_Box *tintfreq;
+extern Fl_Box *tdmares;
+extern Fl_Output *modename;
+extern Fl_Output *drivername;
+#include <FL/Fl_Button.H>
+extern void cb_quit(Fl_Button*, long);
+extern Fl_Button *quit;
+Fl_Window* create_the_forms();
+#endif
diff --git a/hdlcutil/fl/xfhdlcst_main.cxx b/hdlcutil/fl/xfhdlcst_main.cxx
new file mode 100644
index 0000000..bf54292
--- /dev/null
+++ b/hdlcutil/fl/xfhdlcst_main.cxx
@@ -0,0 +1,177 @@
+/*****************************************************************************/
+
+/*
+ * xfhdlcst_main.C -- kernel hdlc radio modem driver status display utility.
+ *
+ * Copyright (C) 1996,1997,2000 Thomas Sailer (sailer@ife.ee.ethz.ch)
+ *
+ * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * Please note that the GPL allows you to use the driver, NOT the radio.
+ * In order to use the radio, you need a license from the communications
+ * authority of your country.
+ *
+ *
+ * History:
+ * 0.1 14.12.1996 Started
+ * 0.2 11.05.1997 introduced hdrvcomm.h
+ * 0.3 05.01.2000 upgraded to fltk 1.0.7
+ */
+
+/*****************************************************************************/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+#include <sys/types.h>
+#include <net/if.h>
+#include "hdrvcomm.h"
+#include "xfhdlcst.h"
+
+/* ---------------------------------------------------------------------- */
+
+static char *progname;
+static bool update = true;
+
+/* ---------------------------------------------------------------------- */
+
+void cb_quit(Fl_Button *, long)
+{
+ exit(0);
+}
+
+/* ---------------------------------------------------------------------- */
+
+void cb_timer(void *)
+{
+ update = true;
+}
+
+/* ---------------------------------------------------------------------- */
+
+static const char *usage_str =
+"[-i smif]\n"
+" -i: specify the name of the baycom kernel driver interface\n\n";
+
+/* ---------------------------------------------------------------------- */
+
+int main(int argc, char *argv[])
+{
+ int c, i;
+ int ret;
+ struct hdrvc_channel_state cs;
+#ifdef HDRVC_KERNEL
+ struct sm_ioctl smi;
+#endif /* HDRVC_KERNEL */
+ char buf[32];
+ char name[64];
+
+ progname = *argv;
+ printf("%s: Version 0.3; (C) 1996,1997,2000 by Thomas Sailer HB9JNX/AE4WA\n", *argv);
+ hdrvc_args(&argc, argv, "bc0");
+ for (i = 1; i < argc; ) {
+ c = i;
+ Fl::arg(argc, argv, c);
+ if (c <= 0) {
+ i++;
+ continue;
+ }
+ memmove(&argv[i], &argv[i+c], (argc-i) * sizeof(char *));
+ argc -= c;
+ }
+#if 0
+ while ((ret = getopt(argc, argv, "")) != -1) {
+ switch (ret) {
+ default:
+ printf("usage: %s %s", *argv, usage_str);
+ exit(-1);
+ }
+ }
+#endif
+ hdrvc_init();
+
+ create_the_forms();
+ Fl::add_timeout(0.1, cb_timer);
+ /*
+ * set driver and modem name
+ */
+ ret = hdrvc_get_mode_name(name, sizeof(name));
+ if (ret < 0) {
+ perror("hdrvc_get_mode_name");
+ modename->hide();
+ } else
+ modename->value(name);
+ ret = hdrvc_get_driver_name(name, sizeof(name));
+ if (ret < 0) {
+ perror("hdrvc_get_driver_name");
+ drivername->hide();
+ } else
+ drivername->value(name);
+ /*
+ * check for soundmodem driver
+ */
+#ifdef HDRVC_KERNEL
+ ret = hdrvc_sm_ioctl(SMCTL_GETDEBUG, &smi);
+ if (ret < 0) {
+#endif /* HDRVC_KERNEL */
+ tdemodcyc->hide();
+ tmodcyc->hide();
+ tintfreq->hide();
+ tdmares->hide();
+ demodcyc->hide();
+ modcyc->hide();
+ intfreq->hide();
+ dmares->hide();
+#ifdef HDRVC_KERNEL
+ }
+#endif /* HDRVC_KERNEL */
+ hdlcst->show();
+ for (;;) {
+ Fl::wait();
+ if (!update)
+ continue;
+ update = false;
+ Fl::add_timeout(0.5, cb_timer);
+ /*
+ * display state
+ */
+ ret = hdrvc_get_channel_state(&cs);
+ if (ret >= 0) {
+ ptt->value(cs.ptt);
+ dcd->value(cs.dcd);
+ sprintf(buf, "%ld", cs.tx_packets);
+ txpacket->value(buf);
+ sprintf(buf, "%ld", cs.tx_errors);
+ txerror->value(buf);
+ sprintf(buf, "%ld", cs.rx_packets);
+ rxpacket->value(buf);
+ sprintf(buf, "%ld", cs.rx_errors);
+ rxerror->value(buf);
+ }
+ ret = hdrvc_sm_ioctl(SMCTL_GETDEBUG, &smi);
+ if (ret >= 0) {
+ sprintf(buf, "%d", smi.data.dbg.int_rate);
+ intfreq->value(buf);
+ sprintf(buf, "%d", smi.data.dbg.mod_cycles);
+ modcyc->value(buf);
+ sprintf(buf, "%d", smi.data.dbg.demod_cycles);
+ demodcyc->value(buf);
+ sprintf(buf, "%d", smi.data.dbg.dma_residue);
+ dmares->value(buf);
+ }
+ }
+ exit (0);
+}
diff --git a/hdlcutil/fl/xfsmdiag.cxx b/hdlcutil/fl/xfsmdiag.cxx
new file mode 100644
index 0000000..84c4bac
--- /dev/null
+++ b/hdlcutil/fl/xfsmdiag.cxx
@@ -0,0 +1,124 @@
+// generated by Fast Light User Interface Designer (fluid) version 1.00
+
+#include "xfsmdiag.h"
+
+Fl_Window *scopewindow=(Fl_Window *)0;
+
+scope *scdisp=(scope *)0;
+
+Fl_Button *cleargr=(Fl_Button *)0;
+
+Fl_Group *scopemode=(Fl_Group *)0;
+
+Fl_Check_Button *sm_off=(Fl_Check_Button *)0;
+
+Fl_Check_Button *sm_input=(Fl_Check_Button *)0;
+
+Fl_Check_Button *sm_demod=(Fl_Check_Button *)0;
+
+Fl_Check_Button *sm_constell=(Fl_Check_Button *)0;
+
+Fl_Check_Button *sm_dcd=(Fl_Check_Button *)0;
+
+Fl_Button *quit=(Fl_Button *)0;
+
+Fl_Round_Button *st_dcd=(Fl_Round_Button *)0;
+
+Fl_Round_Button *st_ptt=(Fl_Round_Button *)0;
+
+Fl_Output *modename=(Fl_Output *)0;
+
+Fl_Output *drivername=(Fl_Output *)0;
+
+Fl_Window* create_the_forms() {
+ Fl_Window* w;
+ { Fl_Window* o = scopewindow = new Fl_Window(700, 550, "SoundCard Modem Driver Diagnose Tool");
+ w = o;
+ o->box(FL_NO_BOX);
+ { Fl_Box* o = new Fl_Box(0, 0, 700, 550);
+ o->box(FL_UP_BOX);
+ }
+ { scope* o = scdisp = new scope(10, 10, 530, 530);
+ o->box(FL_DOWN_BOX);
+ }
+ { Fl_Button* o = cleargr = new Fl_Button(640, 150, 50, 60, "Clear\nGraph");
+ o->callback((Fl_Callback*)cb_cleargr, (void*)(0));
+ }
+ { Fl_Box* o = new Fl_Box(550, 310, 140, 70, "(C) 1996 by\nTom Sailer\nHB9JNX/AE4WA");
+ o->box(FL_EMBOSSED_BOX);
+ o->labelsize(18);
+ o->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
+ }
+ { Fl_Group* o = scopemode = new Fl_Group(550, 10, 140, 130);
+ o->align(FL_ALIGN_CENTER);
+ { Fl_Box* o = new Fl_Box(550, 10, 140, 130);
+ o->box(FL_DOWN_BOX);
+ }
+ { Fl_Check_Button* o = sm_off = new Fl_Check_Button(560, 20, 120, 20, "Off");
+ o->type(102);
+ o->down_box(FL_DIAMOND_DOWN_BOX);
+ o->selection_color(3);
+ o->callback((Fl_Callback*)cb_mode, (void*)(0));
+ }
+ { Fl_Check_Button* o = sm_input = new Fl_Check_Button(560, 40, 120, 20, "Input");
+ o->type(102);
+ o->down_box(FL_DIAMOND_DOWN_BOX);
+ o->selection_color(3);
+ o->callback((Fl_Callback*)cb_mode, (void*)(1));
+ }
+ { Fl_Check_Button* o = sm_demod = new Fl_Check_Button(560, 60, 120, 20, "Demodulator");
+ o->type(102);
+ o->down_box(FL_DIAMOND_DOWN_BOX);
+ o->selection_color(3);
+ o->callback((Fl_Callback*)cb_mode, (void*)(2));
+ }
+ { Fl_Check_Button* o = sm_constell = new Fl_Check_Button(560, 80, 120, 20, "Constellation");
+ o->type(102);
+ o->down_box(FL_DIAMOND_DOWN_BOX);
+ o->selection_color(3);
+ o->callback((Fl_Callback*)cb_mode, (void*)(3));
+ }
+ { Fl_Check_Button* o = sm_dcd = new Fl_Check_Button(560, 110, 120, 20, "Gated with DCD");
+ o->down_box(FL_DIAMOND_DOWN_BOX);
+ o->selection_color(3);
+ o->callback((Fl_Callback*)cb_mode, (void*)(256));
+ }
+ o->end();
+ }
+ { Fl_Button* o = quit = new Fl_Button(550, 270, 140, 30, "Quit");
+ o->callback((Fl_Callback*)cb_quit, (void*)(0));
+ }
+ { Fl_Box* o = new Fl_Box(550, 150, 80, 60);
+ o->box(FL_DOWN_BOX);
+ }
+ { Fl_Round_Button* o = st_dcd = new Fl_Round_Button(600, 160, 20, 20);
+ o->down_box(FL_ROUND_DOWN_BOX);
+ o->selection_color(3);
+ o->align(FL_ALIGN_CENTER);
+ }
+ { Fl_Round_Button* o = st_ptt = new Fl_Round_Button(600, 180, 20, 20);
+ o->down_box(FL_ROUND_DOWN_BOX);
+ o->align(FL_ALIGN_CENTER);
+ }
+ { Fl_Box* o = new Fl_Box(560, 180, 40, 20, "PTT");
+ o->box(FL_FLAT_BOX);
+ o->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
+ }
+ { Fl_Box* o = new Fl_Box(560, 160, 40, 20, "DCD");
+ o->box(FL_FLAT_BOX);
+ o->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
+ }
+ { Fl_Output* o = modename = new Fl_Output(550, 220, 140, 20);
+ o->box(FL_EMBOSSED_BOX);
+ o->selection_color(49);
+ o->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
+ }
+ { Fl_Output* o = drivername = new Fl_Output(550, 240, 140, 20);
+ o->box(FL_EMBOSSED_BOX);
+ o->selection_color(49);
+ o->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
+ }
+ o->end();
+ }
+ return w;
+}
diff --git a/hdlcutil/fl/xfsmdiag.h b/hdlcutil/fl/xfsmdiag.h
new file mode 100644
index 0000000..20fcf18
--- /dev/null
+++ b/hdlcutil/fl/xfsmdiag.h
@@ -0,0 +1,32 @@
+// generated by Fast Light User Interface Designer (fluid) version 1.00
+
+#ifndef xfsmdiag_h
+#define xfsmdiag_h
+#include <FL/Fl.H>
+#include <FL/Fl_Window.H>
+extern Fl_Window *scopewindow;
+#include <FL/Fl_Box.H>
+#include "xfsmdiag_main.h"
+extern scope *scdisp;
+#include <FL/Fl_Button.H>
+extern void cb_cleargr(Fl_Button*, long);
+extern Fl_Button *cleargr;
+#include <FL/Fl_Group.H>
+extern Fl_Group *scopemode;
+#include <FL/Fl_Check_Button.H>
+extern void cb_mode(Fl_Check_Button*, long);
+extern Fl_Check_Button *sm_off;
+extern Fl_Check_Button *sm_input;
+extern Fl_Check_Button *sm_demod;
+extern Fl_Check_Button *sm_constell;
+extern Fl_Check_Button *sm_dcd;
+extern void cb_quit(Fl_Button*, long);
+extern Fl_Button *quit;
+#include <FL/Fl_Round_Button.H>
+extern Fl_Round_Button *st_dcd;
+extern Fl_Round_Button *st_ptt;
+#include <FL/Fl_Output.H>
+extern Fl_Output *modename;
+extern Fl_Output *drivername;
+Fl_Window* create_the_forms();
+#endif
diff --git a/hdlcutil/fl/xfsmdiag_main.cxx b/hdlcutil/fl/xfsmdiag_main.cxx
new file mode 100644
index 0000000..34a801d
--- /dev/null
+++ b/hdlcutil/fl/xfsmdiag_main.cxx
@@ -0,0 +1,412 @@
+/*****************************************************************************/
+
+/*
+ * xfsmdiag.c -- kernel soundcard radio modem driver diagnostics utility.
+ *
+ * Copyright (C) 1996,1997,2000 Thomas Sailer (sailer@ife.ee.ethz.ch)
+ *
+ * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * Please note that the GPL allows you to use the driver, NOT the radio.
+ * In order to use the radio, you need a license from the communications
+ * authority of your country.
+ *
+ *
+ * History:
+ * 0.1 14.12.1996 Started
+ * 0.2 11.05.1997 introduced hdrvcomm.h
+ * 0.3 05.01.2000 upgraded to fltk 1.0.7
+ */
+
+/*****************************************************************************/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <string.h>
+#include <sys/types.h>
+#include <limits.h>
+#include <net/if.h>
+#include <X11/X.h>
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include "hdrvcomm.h"
+#include "xfsmdiag.h"
+#include <FL/x.H>
+#include <FL/fl_draw.H>
+
+/* ---------------------------------------------------------------------- */
+
+static char *progname;
+static unsigned int drawflags = 0;
+
+/* ---------------------------------------------------------------------- */
+
+scope::scope(int x, int y, int w, int h, const char *l)
+ : Fl_Box(x, y, w, h, l)
+{
+ box(FL_DOWN_FRAME);
+ X = x+3;
+ Y = y+4;
+ W = w-6;
+ H = h-8;
+ drawmode = HDRVC_DIAGMODE_OFF;
+ pixmalloc = false;
+ hide();
+}
+
+scope::~scope()
+{
+ if (pixmalloc) {
+ XFreePixmap(fl_display, pixmap);
+ pixmalloc = false;
+ }
+}
+
+void scope::resize(int xx, int yy, int ww, int hh)
+{
+ if (pixmalloc && (ww != w() || hh != h())) {
+ XFreePixmap(fl_display, pixmap);
+ pixmalloc = false;
+ }
+ X = xx+3;
+ Y = yy+4;
+ W = ww-6;
+ H = hh-8;
+ Fl_Box::resize(xx, yy, ww, hh);
+}
+
+void scope::draw()
+{
+ GC gc;
+ XGCValues gcv;
+
+ /* cannot use draw_box(); as it clears the whole window -> flicker */
+ /* from fl_boxtype.C, fl_down_frame */
+ if (W > 0 && H > 0) {
+ fl_color(FL_DARK1); fl_xyline(X-3, Y-4, X+W+1);
+ fl_color(FL_DARK2); fl_yxline(X-3, Y+H+3, Y-3, X+W+1);
+ fl_color(FL_DARK3); fl_yxline(X-2, Y+H+2, Y-2, X+W);
+ fl_color(FL_LIGHT3); fl_xyline(X-1, Y+H+1, X+W+1, Y-2);
+ fl_color(FL_LIGHT2); fl_xyline(X-2, Y+H+2, X+W+2, Y-4);
+ fl_color(FL_LIGHT1); fl_xyline(X-3, Y+H+3, X+W+2);
+ }
+ draw_label();
+ if (pixmalloc)
+ XCopyArea(fl_display, pixmap, fl_window, fl_gc, 0, 0, W, H, X, Y);
+ else {
+ gcv.line_width = 1;
+ gcv.line_style = LineSolid;
+ gcv.fill_style = FillSolid;
+ gc = XCreateGC(fl_display, pixmap, GCLineWidth | GCLineStyle | GCFillStyle, &gcv);
+ XSetState(fl_display, gc, col_background, col_background, GXcopy, AllPlanes);
+ XFillRectangle(fl_display, fl_window, gc, X, Y, W, H);
+ XFreeGC(fl_display, gc);
+ }
+ XSync(fl_display, 0);
+}
+
+/* ---------------------------------------------------------------------- */
+
+int scope::mode(void)
+{
+ mode(drawmode);
+ return drawmode;
+}
+
+void scope::mode(int dmode)
+{
+ Fl_Window *wnd;
+
+ if (dmode != drawmode) {
+ if (pixmalloc) {
+ XFreePixmap(fl_display, pixmap);
+ pixmalloc = false;
+ }
+ drawmode = dmode;
+ switch (drawmode) {
+ case HDRVC_DIAGMODE_OFF:
+ default:
+ hide();
+ break;
+
+ case HDRVC_DIAGMODE_INPUT:
+ case HDRVC_DIAGMODE_DEMOD:
+ size(512+6, 256+8);
+ show();
+ break;
+
+ case HDRVC_DIAGMODE_CONSTELLATION:
+ size(512+6, 512+8);
+ show();
+ break;
+ }
+ }
+ if (pixmalloc || !visible() || W < 2 || H < 2)
+ return;
+ if (!(wnd = window()))
+ return;
+ wnd->make_current();
+ if (!(pixmap = XCreatePixmap(fl_display, fl_window, W, H, fl_visual->depth))) {
+ fprintf(stderr, "unable to open offscreen pixmap\n");
+ exit(1);
+ }
+ pixmalloc = true;
+ col_zeroline = fl_xpixel(FL_RED);
+ col_background = fl_xpixel(FL_WHITE);
+ col_trace = fl_xpixel(FL_BLACK);
+ clear();
+}
+
+/* ---------------------------------------------------------------------- */
+
+void scope::clear(void)
+{
+ GC gc;
+ XGCValues gcv;
+
+ if (!pixmalloc)
+ return;
+ gcv.line_width = 1;
+ gcv.line_style = LineSolid;
+ gcv.fill_style = FillSolid;
+ gc = XCreateGC(fl_display, pixmap, GCLineWidth | GCLineStyle | GCFillStyle, &gcv);
+ XSetState(fl_display, gc, col_background, col_background, GXcopy, AllPlanes);
+ XFillRectangle(fl_display, pixmap, gc, 0, 0, W, H);
+ XFreeGC(fl_display, gc);
+ redraw();
+}
+
+/* ---------------------------------------------------------------------- */
+
+#define WIDTH 512
+
+/* ---------------------------------------------------------------------- */
+
+void scope::drawdata(short data[], int len, int xm)
+{
+ int cnt;
+ GC gc;
+ XGCValues gcv;
+
+ mode();
+ if (!pixmalloc || (drawmode != HDRVC_DIAGMODE_CONSTELLATION &&
+ drawmode != HDRVC_DIAGMODE_INPUT &&
+ drawmode != HDRVC_DIAGMODE_DEMOD))
+ return;
+ gcv.line_width = 1;
+ gcv.line_style = LineSolid;
+ gc = XCreateGC(fl_display, pixmap, GCLineWidth | GCLineStyle, &gcv);
+ if (drawmode == HDRVC_DIAGMODE_CONSTELLATION) {
+#define XCOORD(x) ((SHRT_MAX - (int)(x)) * W / USHRT_MAX)
+#define YCOORD(y) ((SHRT_MAX - (int)(y)) * H / USHRT_MAX)
+ XSetState(fl_display, gc, col_background, col_background, GXcopy, AllPlanes);
+ XSetForeground(fl_display, gc, col_trace);
+ for (cnt = 0; cnt < len-1; cnt += 2)
+ XDrawPoint(fl_display, pixmap, gc, XCOORD(data[cnt]), YCOORD(data[cnt+1]));
+ XSetForeground(fl_display, gc, col_zeroline);
+ XDrawLine(fl_display, pixmap, gc, 0, YCOORD(0), W, YCOORD(0));
+ XDrawLine(fl_display, pixmap, gc, XCOORD(0), 0, XCOORD(0), H);
+#undef XCOORD
+#undef YCOORD
+ } else {
+#define XCOORD(x) ((x) * xm)
+#define YCOORD(y) ((SHRT_MAX - (int)(y)) * H / USHRT_MAX)
+ XSetState(fl_display, gc, col_background, col_background, GXcopy, AllPlanes);
+ if (drawmode == HDRVC_DIAGMODE_INPUT) {
+ XFillRectangle(fl_display, pixmap, gc, 0, 0, W, H);
+ xm = 5;
+ }
+ XSetForeground(fl_display, gc, col_trace);
+ for (cnt = 0; cnt < len-1; cnt++)
+ XDrawLine(fl_display, pixmap, gc, XCOORD(cnt), YCOORD(data[cnt]),
+ XCOORD(cnt+1), YCOORD(data[cnt+1]));
+ XSetForeground(fl_display, gc, col_zeroline);
+ XDrawLine(fl_display, pixmap, gc, 0, YCOORD(0), W, YCOORD(0));
+#undef XCOORD
+#undef YCOORD
+ }
+ XFreeGC(fl_display, gc);
+ redraw();
+}
+
+/* ---------------------------------------------------------------------- */
+
+void cb_cleargr(Fl_Button *, long)
+{
+ scdisp->clear();
+}
+
+/* ---------------------------------------------------------------------- */
+
+void cb_mode(Fl_Check_Button *, long which)
+{
+ struct sm_diag_data diag;
+ short data;
+
+ diag.mode = HDRVC_DIAGMODE_OFF;
+ diag.flags = 0;
+ diag.datalen = 1;
+ diag.data = &data;
+ hdrvc_diag(&diag);
+ switch (which) {
+ case 256:
+ drawflags ^= HDRVC_DIAGFLAG_DCDGATE;
+ break;
+
+ case 0:
+ scdisp->mode(HDRVC_DIAGMODE_OFF);
+ drawflags = 0;
+ break;
+
+ case 1:
+ scdisp->mode(HDRVC_DIAGMODE_INPUT);
+ drawflags = 0;
+ break;
+
+ case 2:
+ scdisp->mode(HDRVC_DIAGMODE_DEMOD);
+ drawflags = HDRVC_DIAGFLAG_DCDGATE;
+ break;
+
+ case 3:
+ scdisp->mode(HDRVC_DIAGMODE_CONSTELLATION);
+ drawflags = HDRVC_DIAGFLAG_DCDGATE;
+ break;
+ }
+ sm_dcd->value(!!(drawflags & HDRVC_DIAGFLAG_DCDGATE));
+}
+
+/* ---------------------------------------------------------------------- */
+
+void cb_quit(Fl_Button *, long)
+{
+ struct sm_diag_data diag;
+ short data;
+
+ diag.mode = HDRVC_DIAGMODE_OFF;
+ diag.flags = 0;
+ diag.datalen = 1;
+ diag.data = &data;
+ hdrvc_diag(&diag);
+ exit(0);
+}
+
+/* ---------------------------------------------------------------------- */
+
+void cb_timer(void *)
+{
+ struct hdrvc_channel_state cs;
+ int ret;
+ short data[256];
+ unsigned int samplesperbit;
+
+ Fl::add_timeout(0.2, cb_timer);
+ /*
+ * display state
+ */
+ ret = hdrvc_get_channel_state(&cs);
+ if (ret < 0) {
+ perror("hdrvc_get_channel_state");
+ } else {
+ st_ptt->value(cs.ptt);
+ st_dcd->value(cs.dcd);
+ }
+ /*
+ * draw scope
+ */
+ if ((ret = hdrvc_diag2(scdisp->mode(), drawflags, data, sizeof(data) / sizeof(short),
+ &samplesperbit)) < 0) {
+ perror("hdrvc_diag2");
+ exit(1);
+ }
+ if (ret > 0)
+ scdisp->drawdata(data, ret, WIDTH / (2*(samplesperbit > 0 ? samplesperbit : 1)));
+}
+
+/* ---------------------------------------------------------------------- */
+
+static const char *usage_str =
+"[-i smif]\n"
+" -i: specify the name of the baycom kernel driver interface\n\n";
+
+/* ---------------------------------------------------------------------- */
+
+int main(int argc, char *argv[])
+{
+ int c, i;
+ int ret;
+ unsigned int ifflags;
+ char name[64];
+
+ progname = *argv;
+ printf("%s: Version 0.3; (C) 1996,1997,2000 by Thomas Sailer HB9JNX/AE4WA\n", *argv);
+
+ hdrvc_args(&argc, argv, "sm0");
+ for (i = 1; i < argc; ) {
+ c = i;
+ Fl::arg(argc, argv, c);
+ if (c <= 0) {
+ i++;
+ continue;
+ }
+ memmove(&argv[i], &argv[i+c], (argc-i) * sizeof(char *));
+ argc -= c;
+ }
+#if 0
+ while ((ret = getopt(argc, argv, "")) != -1) {
+ switch (ret) {
+ default:
+ printf("usage: %s %s", *argv, usage_str);
+ exit(-1);
+ }
+ }
+#endif
+ hdrvc_init();
+ ifflags = hdrvc_get_ifflags();
+ if (!(ifflags & IFF_UP)) {
+ fprintf(stderr, "interface %s down\n", hdrvc_ifname());
+ exit(1);
+ }
+ if (!(ifflags & IFF_RUNNING)) {
+ fprintf(stderr, "interface %s not running\n", hdrvc_ifname());
+ exit(1);
+ }
+ create_the_forms();
+ scdisp->hide();
+ /*
+ * set driver and modem name
+ */
+ ret = hdrvc_get_mode_name(name, sizeof(name));
+ if (ret < 0) {
+ perror("hdrvc_get_mode_name");
+ modename->hide();
+ } else
+ modename->value(name);
+ ret = hdrvc_get_driver_name(name, sizeof(name));
+ if (ret < 0) {
+ perror("hdrvc_get_driver_name");
+ drivername->hide();
+ } else
+ drivername->value(name);
+ Fl::add_timeout(0.1, cb_timer);
+ scopewindow->show();
+ Fl::run();
+ cb_quit(quit, 0);
+ exit(0);
+}
diff --git a/hdlcutil/fl/xfsmdiag_main.h b/hdlcutil/fl/xfsmdiag_main.h
new file mode 100644
index 0000000..38469c4
--- /dev/null
+++ b/hdlcutil/fl/xfsmdiag_main.h
@@ -0,0 +1,70 @@
+/*****************************************************************************/
+
+/*
+ * xfsmdiag_main.h -- kernel soundcard radio modem driver diagnostics utility.
+ *
+ * Copyright (C) 1996,1997,2000 Thomas Sailer (sailer@ife.ee.ethz.ch)
+ *
+ * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * Please note that the GPL allows you to use the driver, NOT the radio.
+ * In order to use the radio, you need a license from the communications
+ * authority of your country.
+ *
+ *
+ * History:
+ * 0.1 14.12.1996 Started
+ * 0.2 11.05.1997 introduced hdrvcomm.h
+ * 0.3 05.01.2000 upgraded to fltk 1.0.7
+ */
+
+/*****************************************************************************/
+
+#ifndef _XFSMDIAG_MAIN_H
+#define _XFSMDIAG_MAIN_H
+
+/* ---------------------------------------------------------------------- */
+
+#include <FL/Fl.H>
+#include <FL/Fl_Box.H>
+#include <FL/x.H>
+
+/* ---------------------------------------------------------------------- */
+
+class scope : public Fl_Box {
+ Pixmap pixmap;
+ bool pixmalloc;
+ int X, Y, W, H;
+ unsigned long col_zeroline;
+ unsigned long col_background;
+ unsigned long col_trace;
+ int drawmode;
+
+protected:
+ void draw();
+ void resize(int, int, int, int);
+
+public:
+ scope(int, int, int, int, const char * = 0);
+ ~scope();
+
+ void drawdata(short data[], int len, int xm);
+ void mode(int dmode);
+ int mode(void);
+ void clear(void);
+};
+
+/* ---------------------------------------------------------------------- */
+#endif /* _XFSMDIAG_MAIN_H */
diff --git a/hdlcutil/fl/xfsmmixer.cxx b/hdlcutil/fl/xfsmmixer.cxx
new file mode 100644
index 0000000..57b5306
--- /dev/null
+++ b/hdlcutil/fl/xfsmmixer.cxx
@@ -0,0 +1,437 @@
+// generated by Fast Light User Interface Designer (fluid) version 1.00
+
+#include "xfsmmixer.h"
+
+Fl_Window *mixer_ad1848=(Fl_Window *)0;
+
+Fl_Value_Slider *ad1848_inl=(Fl_Value_Slider *)0;
+
+Fl_Value_Slider *ad1848_inr=(Fl_Value_Slider *)0;
+
+Fl_Value_Slider *ad1848_outl=(Fl_Value_Slider *)0;
+
+Fl_Value_Slider *ad1848_outr=(Fl_Value_Slider *)0;
+
+Fl_Button *ad1848_quit=(Fl_Button *)0;
+
+Fl_Group *ad1848_srcr=(Fl_Group *)0;
+
+Fl_Check_Button *ad1848_srcr_line=(Fl_Check_Button *)0;
+
+Fl_Check_Button *ad1848_srcr_aux1=(Fl_Check_Button *)0;
+
+Fl_Check_Button *ad1848_srcr_mic=(Fl_Check_Button *)0;
+
+Fl_Check_Button *ad1848_srcr_dac=(Fl_Check_Button *)0;
+
+Fl_Group *ad1848_srcl=(Fl_Group *)0;
+
+Fl_Check_Button *ad1848_srcl_line=(Fl_Check_Button *)0;
+
+Fl_Check_Button *ad1848_srcl_aux1=(Fl_Check_Button *)0;
+
+Fl_Check_Button *ad1848_srcl_mic=(Fl_Check_Button *)0;
+
+Fl_Check_Button *ad1848_srcl_dac=(Fl_Check_Button *)0;
+
+Fl_Window* create_form_ad1848() {
+ Fl_Window* w;
+ { Fl_Window* o = mixer_ad1848 = new Fl_Window(300, 330, "SoundModem Mixer");
+ w = o;
+ o->box(FL_NO_BOX);
+ { Fl_Box* o = new Fl_Box(0, 0, 300, 330);
+ o->box(FL_UP_BOX);
+ }
+ { Fl_Box* o = new Fl_Box(10, 10, 280, 310);
+ o->box(FL_DOWN_BOX);
+ }
+ { Fl_Value_Slider* o = ad1848_inl = new Fl_Value_Slider(20, 20, 30, 270, "Input\nleft");
+ o->type(2);
+ o->labelsize(8);
+ o->callback((Fl_Callback*)update_ad1848);
+ }
+ { Fl_Value_Slider* o = ad1848_inr = new Fl_Value_Slider(60, 20, 30, 270, "Input\nright");
+ o->type(2);
+ o->labelsize(8);
+ o->callback((Fl_Callback*)update_ad1848);
+ }
+ { Fl_Value_Slider* o = ad1848_outl = new Fl_Value_Slider(100, 20, 30, 270, "Output\nleft");
+ o->type(2);
+ o->labelsize(8);
+ o->callback((Fl_Callback*)update_ad1848);
+ }
+ { Fl_Value_Slider* o = ad1848_outr = new Fl_Value_Slider(140, 20, 30, 270, "Output\nright");
+ o->type(2);
+ o->labelsize(8);
+ o->callback((Fl_Callback*)update_ad1848);
+ }
+ { Fl_Button* o = ad1848_quit = new Fl_Button(180, 280, 100, 30, "Quit");
+ o->callback((Fl_Callback*)cb_quit, (void*)(0));
+ }
+ { Fl_Group* o = ad1848_srcr = new Fl_Group(180, 150, 100, 120);
+ o->align(FL_ALIGN_CENTER);
+ { Fl_Box* o = new Fl_Box(180, 150, 100, 120);
+ o->box(FL_DOWN_BOX);
+ }
+ { Fl_Check_Button* o = ad1848_srcr_line = new Fl_Check_Button(190, 180, 60, 20, "Line");
+ o->type(102);
+ o->down_box(FL_DIAMOND_DOWN_BOX);
+ o->selection_color(3);
+ o->callback((Fl_Callback*)update_ad1848);
+ }
+ { Fl_Check_Button* o = ad1848_srcr_aux1 = new Fl_Check_Button(190, 200, 60, 20, "Aux1");
+ o->type(102);
+ o->down_box(FL_DIAMOND_DOWN_BOX);
+ o->selection_color(3);
+ o->callback((Fl_Callback*)update_ad1848);
+ }
+ { Fl_Check_Button* o = ad1848_srcr_mic = new Fl_Check_Button(190, 220, 60, 20, "Mic");
+ o->type(102);
+ o->down_box(FL_DIAMOND_DOWN_BOX);
+ o->selection_color(3);
+ o->callback((Fl_Callback*)update_ad1848);
+ }
+ { Fl_Check_Button* o = ad1848_srcr_dac = new Fl_Check_Button(190, 240, 60, 20, "DAC");
+ o->type(102);
+ o->down_box(FL_DIAMOND_DOWN_BOX);
+ o->selection_color(3);
+ o->callback((Fl_Callback*)update_ad1848);
+ }
+ { Fl_Box* o = new Fl_Box(190, 160, 60, 20, "Right source");
+ o->box(FL_FLAT_BOX);
+ o->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
+ }
+ o->end();
+ }
+ { Fl_Group* o = ad1848_srcl = new Fl_Group(180, 20, 100, 120);
+ o->align(FL_ALIGN_CENTER);
+ { Fl_Box* o = new Fl_Box(180, 20, 100, 120);
+ o->box(FL_DOWN_BOX);
+ }
+ { Fl_Box* o = new Fl_Box(190, 30, 60, 20, "Left source");
+ o->box(FL_FLAT_BOX);
+ o->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
+ }
+ { Fl_Check_Button* o = ad1848_srcl_line = new Fl_Check_Button(190, 50, 60, 20, "Line");
+ o->type(102);
+ o->down_box(FL_DIAMOND_DOWN_BOX);
+ o->selection_color(3);
+ o->callback((Fl_Callback*)update_ad1848);
+ }
+ { Fl_Check_Button* o = ad1848_srcl_aux1 = new Fl_Check_Button(190, 70, 60, 20, "Aux1");
+ o->type(102);
+ o->down_box(FL_DIAMOND_DOWN_BOX);
+ o->selection_color(3);
+ o->callback((Fl_Callback*)update_ad1848);
+ }
+ { Fl_Check_Button* o = ad1848_srcl_mic = new Fl_Check_Button(190, 90, 60, 20, "Mic");
+ o->type(102);
+ o->down_box(FL_DIAMOND_DOWN_BOX);
+ o->selection_color(3);
+ o->callback((Fl_Callback*)update_ad1848);
+ }
+ { Fl_Check_Button* o = ad1848_srcl_dac = new Fl_Check_Button(190, 110, 60, 20, "DAC");
+ o->type(102);
+ o->down_box(FL_DIAMOND_DOWN_BOX);
+ o->selection_color(3);
+ o->callback((Fl_Callback*)update_ad1848);
+ }
+ o->end();
+ }
+ o->end();
+ }
+ return w;
+}
+
+Fl_Window *mixer_ct1335=(Fl_Window *)0;
+
+Fl_Value_Slider *ct1335_out=(Fl_Value_Slider *)0;
+
+Fl_Button *ct1335_quit=(Fl_Button *)0;
+
+Fl_Window* create_form_ct1335() {
+ Fl_Window* w;
+ { Fl_Window* o = mixer_ct1335 = new Fl_Window(100, 360, "SoundModem Mixer");
+ w = o;
+ o->box(FL_NO_BOX);
+ { Fl_Box* o = new Fl_Box(0, 0, 100, 360);
+ o->box(FL_UP_BOX);
+ }
+ { Fl_Box* o = new Fl_Box(10, 10, 80, 340);
+ o->box(FL_DOWN_BOX);
+ }
+ { Fl_Value_Slider* o = ct1335_out = new Fl_Value_Slider(30, 20, 40, 270, "Output");
+ o->type(2);
+ o->labelsize(8);
+ o->callback((Fl_Callback*)update_ct1335);
+ }
+ { Fl_Button* o = ct1335_quit = new Fl_Button(20, 310, 60, 30, "Quit");
+ o->callback((Fl_Callback*)cb_quit, (void*)(0));
+ }
+ o->end();
+ }
+ return w;
+}
+
+Fl_Window *mixer_ct1345=(Fl_Window *)0;
+
+Fl_Value_Slider *ct1345_outl=(Fl_Value_Slider *)0;
+
+Fl_Value_Slider *ct1345_outr=(Fl_Value_Slider *)0;
+
+Fl_Button *ct1345_quit=(Fl_Button *)0;
+
+Fl_Group *ct1345_src=(Fl_Group *)0;
+
+Fl_Check_Button *ct1345_src_mic=(Fl_Check_Button *)0;
+
+Fl_Check_Button *ct1345_src_cd=(Fl_Check_Button *)0;
+
+Fl_Check_Button *ct1345_src_line=(Fl_Check_Button *)0;
+
+Fl_Window* create_form_ct1345() {
+ Fl_Window* w;
+ { Fl_Window* o = mixer_ct1345 = new Fl_Window(190, 330, "SoundModem Mixer");
+ w = o;
+ o->box(FL_NO_BOX);
+ { Fl_Box* o = new Fl_Box(0, 0, 190, 330);
+ o->box(FL_UP_BOX);
+ }
+ { Fl_Box* o = new Fl_Box(10, 10, 170, 310);
+ o->box(FL_DOWN_BOX);
+ }
+ { Fl_Value_Slider* o = ct1345_outl = new Fl_Value_Slider(20, 20, 30, 270, "Output\nleft");
+ o->type(2);
+ o->labelsize(8);
+ o->callback((Fl_Callback*)update_ct1345);
+ }
+ { Fl_Value_Slider* o = ct1345_outr = new Fl_Value_Slider(60, 20, 30, 270, "Output\nright");
+ o->type(2);
+ o->labelsize(8);
+ o->callback((Fl_Callback*)update_ct1345);
+ }
+ { Fl_Button* o = ct1345_quit = new Fl_Button(100, 280, 70, 30, "Quit");
+ o->callback((Fl_Callback*)cb_quit, (void*)(0));
+ }
+ { Fl_Group* o = ct1345_src = new Fl_Group(100, 20, 70, 100);
+ o->align(FL_ALIGN_CENTER);
+ { Fl_Box* o = new Fl_Box(100, 20, 70, 100);
+ o->box(FL_DOWN_BOX);
+ }
+ { Fl_Check_Button* o = ct1345_src_mic = new Fl_Check_Button(110, 50, 50, 20, "Mic");
+ o->type(102);
+ o->down_box(FL_DIAMOND_DOWN_BOX);
+ o->selection_color(3);
+ o->callback((Fl_Callback*)update_ct1345);
+ }
+ { Fl_Check_Button* o = ct1345_src_cd = new Fl_Check_Button(110, 70, 50, 20, "CD");
+ o->type(102);
+ o->down_box(FL_DIAMOND_DOWN_BOX);
+ o->selection_color(3);
+ o->callback((Fl_Callback*)update_ct1345);
+ }
+ { Fl_Check_Button* o = ct1345_src_line = new Fl_Check_Button(110, 90, 50, 20, "Line");
+ o->type(102);
+ o->down_box(FL_DIAMOND_DOWN_BOX);
+ o->selection_color(3);
+ o->callback((Fl_Callback*)update_ct1345);
+ }
+ { Fl_Box* o = new Fl_Box(110, 30, 50, 20, "Source");
+ o->box(FL_FLAT_BOX);
+ o->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
+ }
+ o->end();
+ }
+ o->end();
+ }
+ return w;
+}
+
+Fl_Window *mixer_ct1745=(Fl_Window *)0;
+
+Fl_Value_Slider *ct1745_inl=(Fl_Value_Slider *)0;
+
+Fl_Value_Slider *ct1745_inr=(Fl_Value_Slider *)0;
+
+Fl_Value_Slider *ct1745_outl=(Fl_Value_Slider *)0;
+
+Fl_Value_Slider *ct1745_outr=(Fl_Value_Slider *)0;
+
+Fl_Button *ct1745_quit=(Fl_Button *)0;
+
+Fl_Value_Slider *ct1745_treble=(Fl_Value_Slider *)0;
+
+Fl_Value_Slider *ct1745_bass=(Fl_Value_Slider *)0;
+
+Fl_Group *ct1745_srcl=(Fl_Group *)0;
+
+Fl_Check_Button *ct1745_srcl_mic=(Fl_Check_Button *)0;
+
+Fl_Check_Button *ct1745_srcl_cdl=(Fl_Check_Button *)0;
+
+Fl_Check_Button *ct1745_srcl_cdr=(Fl_Check_Button *)0;
+
+Fl_Check_Button *ct1745_srcl_linel=(Fl_Check_Button *)0;
+
+Fl_Check_Button *ct1745_srcl_midil=(Fl_Check_Button *)0;
+
+Fl_Check_Button *ct1745_srcl_midir=(Fl_Check_Button *)0;
+
+Fl_Check_Button *ct1745_srcl_liner=(Fl_Check_Button *)0;
+
+Fl_Group *ct1745_srcr=(Fl_Group *)0;
+
+Fl_Check_Button *ct1745_srcr_mic=(Fl_Check_Button *)0;
+
+Fl_Check_Button *ct1745_srcr_cdl=(Fl_Check_Button *)0;
+
+Fl_Check_Button *ct1745_srcr_cdr=(Fl_Check_Button *)0;
+
+Fl_Check_Button *ct1745_srcr_linel=(Fl_Check_Button *)0;
+
+Fl_Check_Button *ct1745_srcr_midil=(Fl_Check_Button *)0;
+
+Fl_Check_Button *ct1745_srcr_midir=(Fl_Check_Button *)0;
+
+Fl_Check_Button *ct1745_srcr_liner=(Fl_Check_Button *)0;
+
+Fl_Window* create_form_ct1745() {
+ Fl_Window* w;
+ { Fl_Window* o = mixer_ct1745 = new Fl_Window(430, 330, "SoundModem Mixer");
+ w = o;
+ o->box(FL_NO_BOX);
+ { Fl_Box* o = new Fl_Box(0, 0, 430, 330);
+ o->box(FL_UP_BOX);
+ }
+ { Fl_Box* o = new Fl_Box(10, 10, 410, 310);
+ o->box(FL_DOWN_BOX);
+ }
+ { Fl_Value_Slider* o = ct1745_inl = new Fl_Value_Slider(20, 20, 30, 270, "Input\nleft");
+ o->type(2);
+ o->labelsize(8);
+ o->callback((Fl_Callback*)update_ct1745);
+ }
+ { Fl_Value_Slider* o = ct1745_inr = new Fl_Value_Slider(60, 20, 30, 270, "Input\nright");
+ o->type(2);
+ o->labelsize(8);
+ o->callback((Fl_Callback*)update_ct1745);
+ }
+ { Fl_Value_Slider* o = ct1745_outl = new Fl_Value_Slider(100, 20, 30, 270, "Output\nleft");
+ o->type(2);
+ o->labelsize(8);
+ o->callback((Fl_Callback*)update_ct1745);
+ }
+ { Fl_Value_Slider* o = ct1745_outr = new Fl_Value_Slider(140, 20, 30, 270, "Output\nright");
+ o->type(2);
+ o->labelsize(8);
+ o->callback((Fl_Callback*)update_ct1745);
+ }
+ { Fl_Button* o = ct1745_quit = new Fl_Button(180, 280, 230, 30, "Quit");
+ o->callback((Fl_Callback*)cb_quit, (void*)(0));
+ }
+ { Fl_Value_Slider* o = ct1745_treble = new Fl_Value_Slider(180, 210, 230, 20, "Treble");
+ o->type(3);
+ o->labelsize(8);
+ o->callback((Fl_Callback*)update_ct1745);
+ }
+ { Fl_Value_Slider* o = ct1745_bass = new Fl_Value_Slider(180, 250, 230, 20, "Bass");
+ o->type(3);
+ o->labelsize(8);
+ o->callback((Fl_Callback*)update_ct1745);
+ }
+ { Fl_Group* o = ct1745_srcl = new Fl_Group(180, 20, 110, 180);
+ o->align(FL_ALIGN_CENTER);
+ { Fl_Box* o = new Fl_Box(180, 20, 110, 180);
+ o->box(FL_DOWN_BOX);
+ }
+ { Fl_Box* o = new Fl_Box(191, 29, 89, 18, "Left source");
+ o->box(FL_FLAT_BOX);
+ o->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
+ }
+ { Fl_Check_Button* o = ct1745_srcl_mic = new Fl_Check_Button(190, 50, 90, 20, "Mic");
+ o->down_box(FL_DIAMOND_DOWN_BOX);
+ o->selection_color(3);
+ o->callback((Fl_Callback*)update_ct1745);
+ }
+ { Fl_Check_Button* o = ct1745_srcl_cdl = new Fl_Check_Button(190, 70, 90, 20, "CD left");
+ o->down_box(FL_DIAMOND_DOWN_BOX);
+ o->selection_color(3);
+ o->callback((Fl_Callback*)update_ct1745);
+ }
+ { Fl_Check_Button* o = ct1745_srcl_cdr = new Fl_Check_Button(190, 90, 90, 20, "CD right");
+ o->down_box(FL_DIAMOND_DOWN_BOX);
+ o->selection_color(3);
+ o->callback((Fl_Callback*)update_ct1745);
+ }
+ { Fl_Check_Button* o = ct1745_srcl_linel = new Fl_Check_Button(190, 110, 90, 20, "Line left");
+ o->down_box(FL_DIAMOND_DOWN_BOX);
+ o->selection_color(3);
+ o->callback((Fl_Callback*)update_ct1745);
+ }
+ { Fl_Check_Button* o = ct1745_srcl_midil = new Fl_Check_Button(190, 150, 90, 20, "MIDI left");
+ o->down_box(FL_DIAMOND_DOWN_BOX);
+ o->selection_color(3);
+ o->callback((Fl_Callback*)update_ct1745);
+ }
+ { Fl_Check_Button* o = ct1745_srcl_midir = new Fl_Check_Button(190, 170, 90, 20, "MIDI right");
+ o->down_box(FL_DIAMOND_DOWN_BOX);
+ o->selection_color(3);
+ o->callback((Fl_Callback*)update_ct1745);
+ }
+ { Fl_Check_Button* o = ct1745_srcl_liner = new Fl_Check_Button(190, 130, 90, 20, "Line right");
+ o->down_box(FL_DIAMOND_DOWN_BOX);
+ o->selection_color(3);
+ o->callback((Fl_Callback*)update_ct1745);
+ }
+ o->end();
+ }
+ { Fl_Group* o = ct1745_srcr = new Fl_Group(300, 20, 110, 180);
+ o->align(FL_ALIGN_CENTER);
+ { Fl_Box* o = new Fl_Box(300, 20, 110, 180);
+ o->box(FL_DOWN_BOX);
+ }
+ { Fl_Box* o = new Fl_Box(311, 29, 89, 18, "Right source");
+ o->box(FL_FLAT_BOX);
+ o->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
+ }
+ { Fl_Check_Button* o = ct1745_srcr_mic = new Fl_Check_Button(310, 50, 90, 20, "Mic");
+ o->down_box(FL_DIAMOND_DOWN_BOX);
+ o->selection_color(3);
+ o->callback((Fl_Callback*)update_ct1745);
+ }
+ { Fl_Check_Button* o = ct1745_srcr_cdl = new Fl_Check_Button(310, 70, 90, 20, "CD left");
+ o->down_box(FL_DIAMOND_DOWN_BOX);
+ o->selection_color(3);
+ o->callback((Fl_Callback*)update_ct1745);
+ }
+ { Fl_Check_Button* o = ct1745_srcr_cdr = new Fl_Check_Button(310, 90, 90, 20, "CD right");
+ o->down_box(FL_DIAMOND_DOWN_BOX);
+ o->selection_color(3);
+ o->callback((Fl_Callback*)update_ct1745);
+ }
+ { Fl_Check_Button* o = ct1745_srcr_linel = new Fl_Check_Button(310, 110, 90, 20, "Line left");
+ o->down_box(FL_DIAMOND_DOWN_BOX);
+ o->selection_color(3);
+ o->callback((Fl_Callback*)update_ct1745);
+ }
+ { Fl_Check_Button* o = ct1745_srcr_midil = new Fl_Check_Button(310, 150, 90, 20, "MIDI left");
+ o->down_box(FL_DIAMOND_DOWN_BOX);
+ o->selection_color(3);
+ o->callback((Fl_Callback*)update_ct1745);
+ }
+ { Fl_Check_Button* o = ct1745_srcr_midir = new Fl_Check_Button(310, 170, 90, 20, "MIDI right");
+ o->down_box(FL_DIAMOND_DOWN_BOX);
+ o->selection_color(3);
+ o->callback((Fl_Callback*)update_ct1745);
+ }
+ { Fl_Check_Button* o = ct1745_srcr_liner = new Fl_Check_Button(310, 130, 90, 20, "Line right");
+ o->down_box(FL_DIAMOND_DOWN_BOX);
+ o->selection_color(3);
+ o->callback((Fl_Callback*)update_ct1745);
+ }
+ o->end();
+ }
+ o->end();
+ }
+ return w;
+}
diff --git a/hdlcutil/fl/xfsmmixer.h b/hdlcutil/fl/xfsmmixer.h
new file mode 100644
index 0000000..5a59e8f
--- /dev/null
+++ b/hdlcutil/fl/xfsmmixer.h
@@ -0,0 +1,79 @@
+// generated by Fast Light User Interface Designer (fluid) version 1.00
+
+#ifndef xfsmmixer_h
+#define xfsmmixer_h
+#include <FL/Fl.H>
+#include <FL/Fl_Window.H>
+extern Fl_Window *mixer_ad1848;
+#include <FL/Fl_Box.H>
+#include <FL/Fl_Value_Slider.H>
+extern void update_ad1848(Fl_Widget*, void*);
+extern void update_ad1848(Fl_Value_Slider*, void*);
+extern Fl_Value_Slider *ad1848_inl;
+extern Fl_Value_Slider *ad1848_inr;
+extern Fl_Value_Slider *ad1848_outl;
+extern Fl_Value_Slider *ad1848_outr;
+#include <FL/Fl_Button.H>
+extern void cb_quit(Fl_Button*, long);
+extern Fl_Button *ad1848_quit;
+#include <FL/Fl_Group.H>
+extern Fl_Group *ad1848_srcr;
+#include <FL/Fl_Check_Button.H>
+extern void update_ad1848(Fl_Check_Button*, void*);
+extern Fl_Check_Button *ad1848_srcr_line;
+extern Fl_Check_Button *ad1848_srcr_aux1;
+extern Fl_Check_Button *ad1848_srcr_mic;
+extern Fl_Check_Button *ad1848_srcr_dac;
+extern Fl_Group *ad1848_srcl;
+extern Fl_Check_Button *ad1848_srcl_line;
+extern Fl_Check_Button *ad1848_srcl_aux1;
+extern Fl_Check_Button *ad1848_srcl_mic;
+extern Fl_Check_Button *ad1848_srcl_dac;
+Fl_Window* create_form_ad1848();
+extern Fl_Window *mixer_ct1335;
+extern void update_ct1335(Fl_Widget*, void*);
+extern void update_ct1335(Fl_Value_Slider*, void*);
+extern Fl_Value_Slider *ct1335_out;
+extern Fl_Button *ct1335_quit;
+Fl_Window* create_form_ct1335();
+extern Fl_Window *mixer_ct1345;
+extern void update_ct1345(Fl_Widget*, void*);
+extern void update_ct1345(Fl_Value_Slider*, void*);
+extern Fl_Value_Slider *ct1345_outl;
+extern Fl_Value_Slider *ct1345_outr;
+extern Fl_Button *ct1345_quit;
+extern Fl_Group *ct1345_src;
+extern void update_ct1345(Fl_Check_Button*, void*);
+extern Fl_Check_Button *ct1345_src_mic;
+extern Fl_Check_Button *ct1345_src_cd;
+extern Fl_Check_Button *ct1345_src_line;
+Fl_Window* create_form_ct1345();
+extern Fl_Window *mixer_ct1745;
+extern void update_ct1745(Fl_Widget*, void*);
+extern void update_ct1745(Fl_Value_Slider*, void*);
+extern Fl_Value_Slider *ct1745_inl;
+extern Fl_Value_Slider *ct1745_inr;
+extern Fl_Value_Slider *ct1745_outl;
+extern Fl_Value_Slider *ct1745_outr;
+extern Fl_Button *ct1745_quit;
+extern Fl_Value_Slider *ct1745_treble;
+extern Fl_Value_Slider *ct1745_bass;
+extern Fl_Group *ct1745_srcl;
+extern void update_ct1745(Fl_Check_Button*, void*);
+extern Fl_Check_Button *ct1745_srcl_mic;
+extern Fl_Check_Button *ct1745_srcl_cdl;
+extern Fl_Check_Button *ct1745_srcl_cdr;
+extern Fl_Check_Button *ct1745_srcl_linel;
+extern Fl_Check_Button *ct1745_srcl_midil;
+extern Fl_Check_Button *ct1745_srcl_midir;
+extern Fl_Check_Button *ct1745_srcl_liner;
+extern Fl_Group *ct1745_srcr;
+extern Fl_Check_Button *ct1745_srcr_mic;
+extern Fl_Check_Button *ct1745_srcr_cdl;
+extern Fl_Check_Button *ct1745_srcr_cdr;
+extern Fl_Check_Button *ct1745_srcr_linel;
+extern Fl_Check_Button *ct1745_srcr_midil;
+extern Fl_Check_Button *ct1745_srcr_midir;
+extern Fl_Check_Button *ct1745_srcr_liner;
+Fl_Window* create_form_ct1745();
+#endif
diff --git a/hdlcutil/fl/xfsmmixer_main.cxx b/hdlcutil/fl/xfsmmixer_main.cxx
new file mode 100644
index 0000000..15c3e79
--- /dev/null
+++ b/hdlcutil/fl/xfsmmixer_main.cxx
@@ -0,0 +1,462 @@
+/*****************************************************************************/
+
+/*
+ * xfsmmixer_main.c -- kernel soundcard radio modem driver mixer utility.
+ *
+ * Copyright (C) 1996,1997,2000 Thomas Sailer (sailer@ife.ee.ethz.ch)
+ *
+ * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * Please note that the GPL allows you to use the driver, NOT the radio.
+ * In order to use the radio, you need a license from the communications
+ * authority of your country.
+ *
+ *
+ * History:
+ * 0.1 14.12.1996 Started
+ * 0.2 11.05.1997 introduced hdrvcomm.h
+ * 0.3 05.01.2000 upgraded to fltk 1.0.7
+ */
+
+/*****************************************************************************/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+#include <net/if.h>
+//#include <forms.h>
+#include "hdrvcomm.h"
+#include "xfsmmixer.h"
+
+/* ---------------------------------------------------------------------- */
+
+static char *progname;
+static unsigned int mixdevice;
+
+/* ---------------------------------------------------------------------- */
+
+static int do_mix_ioctl(int cmd, struct sm_mixer_data *mixdat)
+{
+ struct sm_ioctl par;
+ int i;
+
+ par.cmd = cmd;
+ par.data.mix = *mixdat;
+ i = hdrvc_sm_ioctl(cmd, &par);
+ *mixdat = par.data.mix;
+ return i;
+}
+
+/* ---------------------------------------------------------------------- */
+
+static unsigned char get_mixer_reg(unsigned char addr)
+{
+ int i;
+ struct sm_mixer_data mixdat;
+
+ mixdat.reg = addr;
+ if ((i = do_mix_ioctl(SMCTL_GETMIXER, &mixdat)) < 0) {
+ perror("do_mix_ioctl: SMCTL_GETMIXER");
+ exit(1);
+ }
+ if (!i)
+ fprintf(stderr, "warning: mixer device %u register %u not "
+ "accessible for reading!\n", mixdat.mixer_type,
+ addr);
+ if (mixdat.mixer_type != mixdevice) {
+ fprintf(stderr, "error: mixer type changed !?\n");
+ exit(2);
+ }
+ return mixdat.data;
+}
+
+/* ---------------------------------------------------------------------- */
+
+static void set_mixer_reg(unsigned char addr, unsigned char data)
+{
+ struct sm_mixer_data mixdat;
+
+ mixdat.reg = addr;
+ mixdat.data = data;
+ mixdat.mixer_type = mixdevice;
+ if (do_mix_ioctl(SMCTL_SETMIXER, &mixdat) < 0) {
+ perror("do_mix_ioctl: SMCTL_SETMIXER");
+ exit(1);
+ }
+}
+
+/* ---------------------------------------------------------------------- */
+
+void update_ad1848(Fl_Widget *widget, void *udata)
+{
+ unsigned char mdata;
+ float mval;
+
+ mdata = 0;
+ if (ad1848_srcl_line->value())
+ mdata = 0x00;
+ else if (ad1848_srcl_aux1->value())
+ mdata = 0x40;
+ else if (ad1848_srcl_mic->value())
+ mdata = 0x80;
+ else if (ad1848_srcl_dac->value())
+ mdata = 0xc0;
+ mval = ad1848_inl->value();
+ if (mdata == 0x80 && mval >= 20) {
+ mval -= 20;
+ mdata |= 0x20;
+ }
+ mval *= 0.666666;
+ if (mval > 15)
+ mval = 15;
+ mdata |= (int)mval;
+ set_mixer_reg(0x00, mdata);
+ mdata = 0;
+ if (ad1848_srcr_line->value())
+ mdata = 0x00;
+ else if (ad1848_srcr_aux1->value())
+ mdata = 0x40;
+ else if (ad1848_srcr_mic->value())
+ mdata = 0x80;
+ else if (ad1848_srcr_dac->value())
+ mdata = 0xc0;
+ mval = ad1848_inr->value();
+ if (mdata == 0x80 && mval >= 20) {
+ mval -= 20;
+ mdata |= 0x20;
+ }
+ mval *= 0.666666;
+ if (mval > 15)
+ mval = 15;
+ mdata |= (int)mval;
+ set_mixer_reg(0x01, mdata);
+ set_mixer_reg(0x02, 0x80);
+ set_mixer_reg(0x03, 0x80);
+ set_mixer_reg(0x04, 0x80);
+ set_mixer_reg(0x05, 0x80);
+ mval = ad1848_outl->value();
+ if (mval < -95)
+ set_mixer_reg(0x06, 0x80);
+ else
+ set_mixer_reg(0x06, (unsigned char)(mval * (-0.66666666)));
+ mval = ad1848_outr->value();
+ if (mval < -95)
+ set_mixer_reg(0x07, 0x80);
+ else
+ set_mixer_reg(0x07, (unsigned char)(mval * (-0.66666666)));
+ set_mixer_reg(0x0d, 0x00);
+}
+
+/* ---------------------------------------------------------------------- */
+
+void update_ct1335(Fl_Widget *widget, void *udata)
+{
+ float mval;
+
+ mval = ct1335_out->value() * (7.0 / 46.0);
+ set_mixer_reg(0x02, ((((int)(mval)) + 7) << 1));
+ set_mixer_reg(0x06, 0x00);
+ set_mixer_reg(0x08, 0x00);
+ set_mixer_reg(0x0a, 0x06);
+}
+
+/* ---------------------------------------------------------------------- */
+
+void update_ct1345(Fl_Widget *widget, void *udata)
+{
+ unsigned char mdata;
+ double mval;
+
+ set_mixer_reg(0x04, 0xee);
+ set_mixer_reg(0x0a, 0x00);
+ mdata = 0x20;
+ if (ct1345_src_mic->value())
+ mdata = 0x20;
+ else if (ct1345_src_cd->value())
+ mdata = 0x22;
+ else if (ct1345_src_line->value())
+ mdata = 0x26;
+ set_mixer_reg(0x0c, mdata);
+ set_mixer_reg(0x0e, 0x20);
+ mval = ct1345_outl->value() * (7.0 / 46.0);
+ mdata = (((int)(mval))+7) << 5;
+ mval = ct1345_outr->value() * (7.0 / 46.0);
+ mdata |= (((int)(mval))+7) << 1;
+ set_mixer_reg(0x22, mdata);
+ set_mixer_reg(0x26, 0x00);
+ set_mixer_reg(0x28, 0x00);
+ set_mixer_reg(0x2e, 0x00);
+}
+
+/* ---------------------------------------------------------------------- */
+
+void update_ct1745(Fl_Widget *widget, void *udata)
+{
+ unsigned char mdata;
+ float mval;
+
+ set_mixer_reg(0x3c, 0); /* output src: only voice and pcspk */
+ mval = ct1745_treble->value();
+ set_mixer_reg(0x44, ((int)mval)<<4); /* treble.l */
+ set_mixer_reg(0x45, ((int)mval)<<4); /* treble.r */
+ mval = ct1745_bass->value();
+ set_mixer_reg(0x46, ((int)mval)<<4); /* bass.l */
+ set_mixer_reg(0x47, ((int)mval)<<4); /* bass.r */
+ set_mixer_reg(0x3b, 0); /* PC speaker vol -18dB */
+ set_mixer_reg(0x43, 1); /* mic: agc off, fixed 20dB gain */
+ mval = ct1745_outl->value();
+ mdata = 0;
+ while (mval > 0) {
+ mval -= 6;
+ mdata += 0x40;
+ }
+ set_mixer_reg(0x41, mdata); /* output gain */
+ set_mixer_reg(0x30, 0xf8); /* master vol */
+ set_mixer_reg(0x32, ((int)(mval * 0.5) + 31) << 3); /* voice vol */
+ mval = ct1745_outr->value();
+ mdata = 0;
+ while (mval > 0) {
+ mval -= 6;
+ mdata += 0x40;
+ }
+ set_mixer_reg(0x42, mdata); /* output gain */
+ set_mixer_reg(0x31, 0xf8); /* master vol */
+ set_mixer_reg(0x33, ((int)(mval * 0.5) + 31) << 3); /* voice vol */
+ mval = ct1745_inl->value();
+ mdata = 0;
+ while (mval > 0) {
+ mval -= 6;
+ mdata += 0x40;
+ }
+ set_mixer_reg(0x3f, mdata); /* input gain */
+ mdata = ((int)(mval * 0.5) + 31) << 3;
+ set_mixer_reg(0x34, mdata); /* midi vol */
+ set_mixer_reg(0x36, mdata); /* cd vol */
+ set_mixer_reg(0x38, mdata); /* line vol */
+ set_mixer_reg(0x3a, mdata); /* mic vol */
+ mval = ct1745_inr->value();
+ mdata = 0;
+ while (mval > 0) {
+ mval -= 6;
+ mdata += 0x40;
+ }
+ set_mixer_reg(0x40, mdata); /* input gain */
+ mdata = ((int)(mval * 0.5) + 31) << 3;
+ set_mixer_reg(0x35, mdata); /* midi vol */
+ set_mixer_reg(0x37, mdata); /* cd vol */
+ set_mixer_reg(0x39, mdata); /* line vol */
+ mdata = 0;
+ if (ct1745_srcl_mic->value())
+ mdata |= 0x01;
+ if (ct1745_srcl_cdl->value())
+ mdata |= 0x04;
+ if (ct1745_srcl_cdr->value())
+ mdata |= 0x02;
+ if (ct1745_srcl_linel->value())
+ mdata |= 0x10;
+ if (ct1745_srcl_liner->value())
+ mdata |= 0x08;
+ if (ct1745_srcl_midil->value())
+ mdata |= 0x40;
+ if (ct1745_srcl_midir->value())
+ mdata |= 0x20;
+ set_mixer_reg(0x3d, mdata); /* input sources left */
+ mdata = 0;
+ if (ct1745_srcr_mic->value())
+ mdata |= 0x01;
+ if (ct1745_srcr_cdl->value())
+ mdata |= 0x04;
+ if (ct1745_srcr_cdr->value())
+ mdata |= 0x02;
+ if (ct1745_srcr_linel->value())
+ mdata |= 0x10;
+ if (ct1745_srcr_liner->value())
+ mdata |= 0x08;
+ if (ct1745_srcr_midil->value())
+ mdata |= 0x40;
+ if (ct1745_srcr_midir->value())
+ mdata |= 0x20;
+ set_mixer_reg(0x3e, mdata); /* input sources right*/
+}
+
+/* ---------------------------------------------------------------------- */
+
+void cb_quit(Fl_Button *, long)
+{
+ exit (0);
+}
+
+/* ---------------------------------------------------------------------- */
+
+static const char *usage_str =
+"[-i smif]\n"
+" -i: specify the name of the soundmodem kernel driver interface\n\n";
+
+/* ---------------------------------------------------------------------- */
+
+int main(int argc, char *argv[])
+{
+ int c, i;
+ struct sm_mixer_data mixdat;
+ unsigned char mdata;
+
+ progname = *argv;
+ printf("%s: Version 0.3; (C) 1996,1997,2000 by Thomas Sailer HB9JNX/AE4WA\n", progname);
+ hdrvc_args(&argc, argv, "sm0");
+ for (i = 1; i < argc; ) {
+ c = i;
+ Fl::arg(argc, argv, c);
+ if (c <= 0) {
+ i++;
+ continue;
+ }
+ memmove(&argv[i], &argv[i+c], (argc-i) * sizeof(char *));
+ argc -= c;
+ }
+#if 0
+ while ((ret = getopt(argc, argv, "")) != -1) {
+ switch (ret) {
+ default:
+ printf("usage: %s %s", progname, usage_str);
+ exit(-1);
+ }
+ }
+#endif
+ hdrvc_init();
+ /*
+ * set mixer
+ */
+ mixdat.reg = 0;
+ if (do_mix_ioctl(SMCTL_GETMIXER, &mixdat) < 0) {
+ perror("do_mix_ioctl: SMCTL_GETMIXER");
+ mixdevice = SM_MIXER_INVALID;
+ } else
+ mixdevice = mixdat.mixer_type;
+ switch (mixdevice) {
+ case SM_MIXER_INVALID:
+ printf("invalid mixer device\n");
+ exit(1);
+
+ case SM_MIXER_AD1848:
+ case SM_MIXER_CRYSTAL:
+ printf("Mixer device: %s\n", mixdevice == SM_MIXER_CRYSTAL ?
+ "CS423x" : "AD1848");
+ create_form_ad1848();
+ mdata = get_mixer_reg(0);
+ ad1848_inl->step(1.5);
+ ad1848_inl->bounds(42.5, 0);
+ ad1848_inl->value((((mdata & 0xe0) == 0xa0) ? 20 : 0) + (mdata & 0xf) * 1.5);
+ ad1848_srcl_line->value((mdata & 0xc0) == 0x00);
+ ad1848_srcl_aux1->value((mdata & 0xc0) == 0x40);
+ ad1848_srcl_mic->value((mdata & 0xc0) == 0x80);
+ ad1848_srcl_dac->value((mdata & 0xc0) == 0xc0);
+ mdata = get_mixer_reg(1);
+ ad1848_inr->step(1.5);
+ ad1848_inr->bounds(42.5, 0);
+ ad1848_inr->value((((mdata & 0xe0) == 0xa0) ? 20 : 0) + (mdata & 0xf) * 1.5);
+ ad1848_srcr_line->value((mdata & 0xc0) == 0x00);
+ ad1848_srcr_aux1->value((mdata & 0xc0) == 0x40);
+ ad1848_srcr_mic->value((mdata & 0xc0) == 0x80);
+ ad1848_srcr_dac->value((mdata & 0xc0) == 0xc0);
+ mdata = get_mixer_reg(6);
+ ad1848_outl->step(1.5);
+ ad1848_outl->bounds(0, -100);
+ ad1848_outl->value((mdata & 0x80) ? -100 : (mdata & 0x3f) * -1.5);
+ mdata = get_mixer_reg(7);
+ ad1848_outr->step(1.5);
+ ad1848_outr->bounds(0, -100);
+ ad1848_outr->value((mdata & 0x80) ? -100 : (mdata & 0x3f) * -1.5);
+ mixer_ad1848->show();
+ break;
+
+ case SM_MIXER_CT1335:
+ printf("Mixer device: CT1335\n");
+ create_form_ct1335();
+ mdata = get_mixer_reg(0x2);
+ ct1335_out->step(46.0/7.0);
+ ct1335_out->bounds(0, -46);
+ ct1335_out->value((((int)((mdata >> 1) & 7)) - 7) * (46.0/7.0));
+ mixer_ct1335->show();
+ break;
+
+ case SM_MIXER_CT1345:
+ printf("Mixer device: CT1345\n");
+ create_form_ct1345();
+ mdata = get_mixer_reg(0x22);
+ ct1345_outl->step(46.0/7.0);
+ ct1345_outl->bounds(0, -46);
+ ct1345_outl->value((((int)((mdata >> 5) & 7)) - 7) * (46.0/7.0));
+ ct1345_outr->step(46.0/7.0);
+ ct1345_outr->bounds(0, -46);
+ ct1345_outr->value((((int)((mdata >> 1) & 7)) - 7) * (46.0/7.0));
+ mdata = get_mixer_reg(0xc);
+ ct1345_src_mic->value((mdata & 6) == 0 || (mdata & 6) == 4);
+ ct1345_src_cd->value((mdata & 6) == 2);
+ ct1345_src_line->value((mdata & 6) == 6);
+ mixer_ct1345->show();
+ break;
+
+ case SM_MIXER_CT1745:
+ printf("Mixer device: CT1745\n");
+ create_form_ct1745();
+ ct1745_outl->step(2);
+ ct1745_outl->bounds(0, -62);
+ ct1745_outl->value(((int)((get_mixer_reg(0x32) >> 3) & 0x1f) - 31) * 2 +
+ ((get_mixer_reg(0x41) >> 6) & 0x3) * 6);
+ ct1745_outr->step(2);
+ ct1745_outr->bounds(0, -62);
+ ct1745_outr->value(((int)((get_mixer_reg(0x33) >> 3) & 0x1f) - 31) * 2 +
+ ((get_mixer_reg(0x42) >> 6) & 0x3) * 6);
+ ct1745_inl->step(2);
+ ct1745_inl->bounds(0, -62);
+ ct1745_inl->value(((int)((get_mixer_reg(0x38) >> 3) & 0x1f) - 31) * 2 +
+ ((get_mixer_reg(0x3f) >> 6) & 0x3) * 6);
+ ct1745_inr->step(2);
+ ct1745_inr->bounds(0, -62);
+ ct1745_inr->value(((int)((get_mixer_reg(0x39) >> 3) & 0x1f) - 31) * 2 +
+ ((get_mixer_reg(0x40) >> 6) & 0x3) * 6);
+ mdata = get_mixer_reg(0x3d);
+ ct1745_srcl_mic->value(!!(mdata & 1));
+ ct1745_srcl_cdl->value(!!(mdata & 4));
+ ct1745_srcl_cdr->value(!!(mdata & 2));
+ ct1745_srcl_linel->value(!!(mdata & 0x10));
+ ct1745_srcl_liner->value(!!(mdata & 8));
+ ct1745_srcl_midil->value(!!(mdata & 0x40));
+ ct1745_srcl_midir->value(!!(mdata & 0x20));
+ mdata = get_mixer_reg(0x3e);
+ ct1745_srcr_mic->value(!!(mdata & 1));
+ ct1745_srcr_cdl->value(!!(mdata & 4));
+ ct1745_srcr_cdr->value(!!(mdata & 2));
+ ct1745_srcr_linel->value(!!(mdata & 0x10));
+ ct1745_srcr_liner->value(!!(mdata & 8));
+ ct1745_srcr_midil->value(!!(mdata & 0x40));
+ ct1745_srcr_midir->value(!!(mdata & 0x20));
+ ct1745_treble->step(1);
+ ct1745_treble->bounds(7, -8);
+ ct1745_treble->value((get_mixer_reg(0x44) >> 4) & 0xf);
+ ct1745_bass->step(1);
+ ct1745_bass->bounds(7, -8);
+ ct1745_bass->value((get_mixer_reg(0x46) >> 4) & 0xf);
+ mixer_ct1745->show();
+ break;
+
+ default:
+ printf("unknown mixer device %d\n", mixdevice);
+ exit(1);
+ }
+ Fl::run();
+ exit(0);
+}
diff --git a/hdlcutil/hdrvcomm.c b/hdlcutil/hdrvcomm.c
index 05259e5..2c7560e 100644
--- a/hdlcutil/hdrvcomm.c
+++ b/hdlcutil/hdrvcomm.c
@@ -3,7 +3,7 @@
/*
* hdrvcomm.c -- HDLC driver communications.
*
- * Copyright (C) 1996 Thomas Sailer (sailer@ife.ee.ethz.ch)
+ * Copyright (C) 1996-1998 Thomas Sailer (sailer@ife.ee.ethz.ch)
*
* 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
@@ -25,7 +25,8 @@
*
*
* History:
- * 0.1 10.5.97 Started
+ * 0.1 10.05.97 Started
+ * 0.2 14.04.98 Tried to implement AF_PACKET
*/
/*****************************************************************************/
@@ -36,33 +37,34 @@
#include <errno.h>
#include <sys/ioctl.h>
#include <sys/types.h>
-#include <sys/socket.h>
+/*#include <sys/socket.h>*/
#include <sys/ipc.h>
#include <sys/msg.h>
#include <asm/byteorder.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
-#ifdef __GLIBC__
-#include <netinet/if_ether.h>
-#else
-#include <linux/if_ether.h>
-#endif
#include <net/if.h>
#include "hdrvcomm.h"
#include "usersmdiag.h"
+#include <net/if_arp.h>
+#include <linux/if_ether.h>
+#include <linux/if_packet.h>
+#ifndef SOL_PACKET
+#define SOL_PACKET 263
+#endif
-#include <linux/hdlcdrv.h>
/* ---------------------------------------------------------------------- */
#ifdef HDRVC_KERNEL
static int kernel_mode = 1;
#endif /* HDRVC_KERNEL */
-static char *if_name = "bc0";
+static char *if_name = "bcsf0";
static char *prg_name;
static int fd = -1;
static struct ifreq ifr_h;
static int promisc = 0;
+static int afpacket = 1;
static int msqid = -1;
/* ---------------------------------------------------------------------- */
@@ -93,39 +95,62 @@ static void terminate_sig(int signal)
int hdrvc_recvpacket(char *pkt, int maxlen)
{
struct ifreq ifr_new;
- struct sockaddr from;
+ struct sockaddr_ll from;
int from_len = sizeof(from);
#ifdef HDRVC_KERNEL
if (kernel_mode) {
if (!promisc) {
- struct sockaddr sa;
+ if (afpacket) {
+ struct sockaddr_ll sll;
+ struct packet_mreq mr;
+
+ memset(&sll, 0, sizeof(sll));
+ sll.sll_family = AF_PACKET;
+ sll.sll_ifindex = ifr_h.ifr_ifindex;
+ sll.sll_protocol = htons(ETH_P_AX25);
+ if (bind(fd, (struct sockaddr *)&sll, sizeof(sll)) < 0) {
+ fprintf(stderr, "%s: Error %s (%i) bind failed\n",
+ prg_name, strerror(errno), errno);
+ exit(-2);
+ }
+ memset(&mr, 0, sizeof(mr));
+ mr.mr_ifindex = sll.sll_ifindex;
+ mr.mr_type = PACKET_MR_PROMISC;
+ if (setsockopt(fd, SOL_PACKET, PACKET_ADD_MEMBERSHIP, (char *)&mr, sizeof(mr)) < 0) {
+ fprintf(stderr, "%s: Error %s (%i) setsockopt SOL_PACKET, PACKET_ADD_MEMBERSHIP failed\n",
+ prg_name, strerror(errno), errno);
+ exit(-2);
+ }
+ } else {
+ struct sockaddr sa;
- strcpy(sa.sa_data, if_name);
- sa.sa_family = AF_INET;
- if (bind(fd, &sa, sizeof(struct sockaddr)) < 0) {
- fprintf(stderr, "%s: Error %s (%i) bind failed\n",
- prg_name, strerror(errno), errno);
- exit(-2);
- }
- ifr_new = ifr_h;
- ifr_new.ifr_flags |= IFF_PROMISC;
- if (ioctl(fd, SIOCSIFFLAGS, &ifr_new) < 0) {
- perror("ioctl (SIOCSIFFLAGS)");
- exit(1);
- }
- signal(SIGTERM, terminate_sig);
- signal(SIGQUIT, terminate_sig);
- if (atexit((void (*)(void))terminate)) {
- perror("atexit");
- terminate();
+ strcpy(sa.sa_data, if_name);
+ sa.sa_family = AF_INET;
+ if (bind(fd, &sa, sizeof(sa)) < 0) {
+ fprintf(stderr, "%s: Error %s (%i) bind failed\n",
+ prg_name, strerror(errno), errno);
+ exit(-2);
+ }
+ ifr_new = ifr_h;
+ ifr_new.ifr_flags |= IFF_PROMISC;
+ if (ioctl(fd, SIOCSIFFLAGS, &ifr_new) < 0) {
+ perror("ioctl (SIOCSIFFLAGS)");
+ exit(1);
+ }
+ signal(SIGTERM, terminate_sig);
+ signal(SIGQUIT, terminate_sig);
+ if (atexit((void (*)(void))terminate)) {
+ perror("atexit");
+ terminate();
+ }
}
promisc = 1;
fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_NONBLOCK);
}
if (!pkt || maxlen < 2)
return 0;
- return recvfrom(fd, pkt, maxlen, 0, &from, &from_len);
+ return recvfrom(fd, pkt, maxlen, 0, (struct sockaddr *)&from, &from_len);
}
#endif /* HDRVC_KERNEL */
return -1;
@@ -185,34 +210,53 @@ void hdrvc_args(int *argc, char *argv[], char *def_if)
void hdrvc_init(void)
{
+ key_t k;
+ static struct ifreq ifr;
+
#ifdef HDRVC_KERNEL
if (kernel_mode) {
- if ((fd = socket(PF_INET, SOCK_PACKET, htons(ETH_P_AX25))) < 0) {
- fprintf(stderr, "%s: Error %s (%i), cannot open %s\n", prg_name,
- strerror(errno), errno, if_name);
- exit(-1);
- }
strcpy(ifr_h.ifr_name, if_name);
- if (ioctl(fd, SIOCGIFFLAGS, &ifr_h) < 0) {
- fprintf(stderr, "%s: Error %s (%i), cannot ioctl %s\n", prg_name,
- strerror(errno), errno, if_name);
- exit(-1);
+ /* first try to use AF_PACKET */
+ if ((fd = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_AX25))) < 0
+ || ioctl(fd, SIOCGIFINDEX, &ifr_h) < 0) {
+ if (fd >= 0)
+ close(fd);
+ afpacket = 0;
+ if ((fd = socket(PF_INET, SOCK_PACKET, htons(ETH_P_AX25))) < 0) {
+ fprintf(stderr, "%s: Error %s (%i), cannot open %s\n", prg_name,
+ strerror(errno), errno, if_name);
+ exit(-1);
+ }
+ if (ioctl(fd, SIOCGIFFLAGS, &ifr_h) < 0) {
+ fprintf(stderr, "%s: Error %s (%i), cannot ioctl SIOCGIFFLAGS %s\n", prg_name,
+ strerror(errno), errno, if_name);
+ exit(-1);
+ }
}
- } else
-#endif /* HDRVC_KERNEL */
- {
- key_t k = ftok(if_name, USERSM_KEY_PROJ);
-
- if (k == (key_t)-1) {
- fprintf(stderr, "%s: Error %s (%i), cannot ftok on %s\n", prg_name,
+ strcpy(ifr.ifr_name, if_name);
+ if (ioctl(fd, SIOCGIFHWADDR, &ifr) < 0 ) {
+ fprintf(stderr, "%s: Error %s (%i), cannot ioctl SIOCGIFHWADDR %s\n", prg_name,
strerror(errno), errno, if_name);
exit(-1);
- }
- if ((msqid = msgget(k, 0700)) < 0) {
- fprintf(stderr, "%s: Error %s (%i), cannot msgget %d\n", prg_name,
- strerror(errno), errno, k);
+ }
+ if (ifr.ifr_hwaddr.sa_family != ARPHRD_AX25) {
+ fprintf(stderr, "%s: Error, interface %s not AX25 (%i)\n", prg_name,
+ if_name, ifr.ifr_hwaddr.sa_family);
exit(-1);
}
+ return;
+ }
+#endif /* HDRVC_KERNEL */
+ k = ftok(if_name, USERSM_KEY_PROJ);
+ if (k == (key_t)-1) {
+ fprintf(stderr, "%s: Error %s (%i), cannot ftok on %s\n", prg_name,
+ strerror(errno), errno, if_name);
+ exit(-1);
+ }
+ if ((msqid = msgget(k, 0700)) < 0) {
+ fprintf(stderr, "%s: Error %s (%i), cannot msgget %d\n", prg_name,
+ strerror(errno), errno, k);
+ exit(-1);
}
}
diff --git a/hdlcutil/hdrvcomm.h b/hdlcutil/hdrvcomm.h
index 3167b03..4778d6a 100644
--- a/hdlcutil/hdrvcomm.h
+++ b/hdlcutil/hdrvcomm.h
@@ -30,9 +30,13 @@
#ifndef _HDRVCOMM_H
#define _HDRVCOMM_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* ---------------------------------------------------------------------- */
-#define HDRVC_KERNEL 1 //why was undef here ???
+#define HDRVC_KERNEL 1
/* ---------------------------------------------------------------------- */
@@ -106,4 +110,7 @@ extern int hdrvc_diag(struct sm_diag_data *diag);
#endif /* HDRVC_KERNEL */
/* ---------------------------------------------------------------------- */
+#ifdef __cplusplus
+ }
+#endif
#endif /* _HDRVCOMM_H */
diff --git a/hdlcutil/setcrystal.c b/hdlcutil/setcrystal.c
deleted file mode 100644
index 926eddd..0000000
--- a/hdlcutil/setcrystal.c
+++ /dev/null
@@ -1,140 +0,0 @@
-/*****************************************************************************/
-
-/*
- * setcrystal.c -- crystal soundcard configuration utility
- *
- * Copyright (C) 1996 Thomas Sailer (sailer@ife.ee.ethz.ch)
- *
- * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * Please note that the GPL allows you to use the driver, NOT the radio.
- * In order to use the radio, you need a license from the communications
- * authority of your country.
- *
- */
-
-/* --------------------------------------------------------------------- */
-
-#include <stdio.h>
-#include <unistd.h>
-#include <stdlib.h>
-#ifdef __GLIBC__
-#include <sys/io.h>
-#else
-#include <asm/io.h>
-#endif
-
-/* --------------------------------------------------------------------- */
-
-static const unsigned char crystal_key[32] = {
- 0x96, 0x35, 0x9a, 0xcd, 0xe6, 0xf3, 0x79, 0xbc,
- 0x5e, 0xaf, 0x57, 0x2b, 0x15, 0x8a, 0xc5, 0xe2,
- 0xf1, 0xf8, 0x7c, 0x3e, 0x9f, 0x4f, 0x27, 0x13,
- 0x09, 0x84, 0x42, 0xa1, 0xd0, 0x68, 0x34, 0x1a
-};
-
-#define KEY_PORT 0x279
-#define CSN 1 /* card select number */
-
-/* --------------------------------------------------------------------- */
-
-int main(int argc, char *argv[])
-{
- int wssbase = 0x534;
- int synbase = 0x388;
- int sbbase = 0x220;
- int irq = 5;
- int dma = 1;
- int dma2 = 3;
-
- int i;
-
- printf("Crystal PnP Soundcard enabler\n"
- "(C) 1996 by Thomas Sailer, HB9JNX/AE4WA\n"
- "WARNING: This utility is incompatible with OS PnP support!\n"
- " Remove it as soon as Linux supports PnP!\n");
- while ((i = getopt(argc, argv, "i:d:c:s:w:f:h")) != EOF) {
- switch (i) {
- case 'i':
- irq = strtoul(optarg, NULL, 0);
- break;
- case 'd':
- dma = strtoul(optarg, NULL, 0);
- break;
- case 'c':
- dma2 = strtoul(optarg, NULL, 0);
- break;
- case 's':
- sbbase = strtoul(optarg, NULL, 0);
- break;
- case 'w':
- wssbase = strtoul(optarg, NULL, 0);
- break;
- case 'f':
- synbase = strtoul(optarg, NULL, 0);
- break;
-
- default:
- case ':':
- case '?':
- case 'h':
- fprintf(stderr, "usage: [-w wssio] [-s sbio] "
- "[-f synthio] [-i irq] [-d dma] [-c dma2]\n");
- exit(1);
- }
- }
-
- if ((i = ioperm(KEY_PORT, 1, 1))) {
- perror("ioperm");
- exit(1);
- }
- /*
- * send crystal key
- */
- for (i = 0; i < 32; i++)
- outb(crystal_key[i], KEY_PORT);
- /*
- * send config data
- */
- outb(0x6, KEY_PORT);
- outb(CSN, KEY_PORT);
- outb(0x15, KEY_PORT);
- outb(0x0, KEY_PORT); /* logical device 0 */
- outb(0x47, KEY_PORT);
- outb(wssbase >> 8, KEY_PORT);
- outb(wssbase & 0xff, KEY_PORT);
- outb(0x48, KEY_PORT);
- outb(synbase >> 8, KEY_PORT);
- outb(synbase & 0xff, KEY_PORT);
- outb(0x42, KEY_PORT);
- outb(sbbase >> 8, KEY_PORT);
- outb(sbbase & 0xff, KEY_PORT);
- outb(0x22, KEY_PORT);
- outb(irq, KEY_PORT);
- outb(0x2a, KEY_PORT);
- outb(dma, KEY_PORT);
- outb(0x25, KEY_PORT);
- outb(dma2, KEY_PORT);
- outb(0x33, KEY_PORT);
- outb(0x1, KEY_PORT); /* activate logical device */
- outb(0x79, KEY_PORT); /* activate part */
-
- printf("Crystal CS423[26] set to: WSS iobase 0x%x, Synth iobase 0x%x,"
- " SB iobase 0x%x,\n IRQ %u, DMA %u, DMA2 %u\n", wssbase,
- synbase, sbbase, irq, dma, dma2);
- exit(0);
-}
-
-/* --------------------------------------------------------------------- */
diff --git a/hdlcutil/sethdlc.c b/hdlcutil/sethdlc.c
index b07c0de..c42a807 100644
--- a/hdlcutil/sethdlc.c
+++ b/hdlcutil/sethdlc.c
@@ -3,7 +3,7 @@
/*
* sethdlc.c -- kernel HDLC radio modem driver setup utility.
*
- * Copyright (C) 1996 Thomas Sailer (sailer@ife.ee.ethz.ch)
+ * Copyright (C) 1996,1997,2000 Thomas Sailer (sailer@ife.ee.ethz.ch)
*
* 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
@@ -25,9 +25,10 @@
*
*
* History:
- * 0.1 16.10.96 Adapted from setbaycom.c and setsm.c
- * 0.2 20.11.96 New mode set/query code
- * 0.5 11.05.97 introduced hdrvcomm.h
+ * 0.1 16.10.1996 Adapted from setbaycom.c and setsm.c
+ * 0.2 20.11.1996 New mode set/query code
+ * 0.5 11.05.1997 introduced hdrvcomm.h
+ * 0.6 05.01.2000 glibc compile fixes
*/
/*****************************************************************************/
@@ -41,13 +42,9 @@
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
-/*#include <linux/if.h>*/
#include <net/if.h>
#include "hdrvcomm.h"
-#include <linux/soundmodem.h>
-#include <linux/baycom.h>
-
/* ---------------------------------------------------------------------- */
static unsigned char trace_stat = 0;
diff --git a/hdlcutil/smdiag.8 b/hdlcutil/smdiag.8
new file mode 100644
index 0000000..276a1b7
--- /dev/null
+++ b/hdlcutil/smdiag.8
@@ -0,0 +1,78 @@
+.\" Copyright 1996 Thomas Sailer (sailer@ife.ee.ethz.ch)
+.\" May be distributed under the GNU General Public License
+.\" "
+.TH SMDIAG 8 "1 October 1996" "Smdiag 0.1" "Linux Programmer's Manual"
+.SH NAME
+smdiag \- Linux soundcard packet radio modem driver diagnostics utility
+.SH SYNOPSIS
+.B smdiag
+.B "[\-i device]"
+.B "[\-d display]"
+.B "[ \-ce ]"
+
+.SH DESCRIPTION
+.B smdiag
+may help to adjust the audio levels of the soundcard modem driver, as well
+as to control the quality of the radio link. It may either display an
+oscilloscope like view of the input signal, or display an eye diagram.
+The display may be gated with DCD, i.e. only updated if the modem detects
+a data carrier.
+
+.SH OPTIONS
+.B smdiag
+accepts the following options:
+
+.TP
+.B \-i
+The
+.I device
+argument specifies the soundcard modem device which should be configured or
+interrogated. It will usually have the following form:
+.I sm[0-3].
+.TP
+.B \-d
+sets the address of the X server to display the window.
+.TP
+.B \-h
+display an overview of the available command line parameters and exit.
+.TP
+.B \-c
+toggle the carrier gating of the display.
+.TP
+.B \-e
+display an eye diagram (overlay of the synchronized demodulator output)
+instead of an oscilloscope view of the input signal.
+
+.SH KEYS
+.TP
+.B C
+clears the window
+.TP
+.B D
+toggles the DCD gating.
+.TP
+.B E
+displays an eye diagram
+.TP
+.B I
+displays the input signal
+.TP
+.B Q
+quits
+.I smdiag
+
+.SH BUGS
+.B smdiag
+Reacts sluggishly to keypresses. The window size is fixed. For speed reasons,
+two square root operations per sample are not implemented in the AFSK 1200
+baud modes. The eye diagram for the AFSK 1200 baud mode is therefore
+distorted.
+
+.SH "SEE ALSO"
+.BR smmixer " (8), " sethdlc " (8),"
+linux/drivers/net/soundmodem.c
+
+.SH AUTHOR
+smdiag was written by Thomas Sailer (sailer@ife.ee.ethz.ch).
+
+
diff --git a/hdlcutil/smdiag.c b/hdlcutil/smdiag.c
new file mode 100644
index 0000000..6d279e7
--- /dev/null
+++ b/hdlcutil/smdiag.c
@@ -0,0 +1,431 @@
+/*****************************************************************************/
+
+/*
+ * smdiag.c -- kernel soundcard radio modem driver diagnostics utility.
+ *
+ * Copyright (C) 1996,1997,2000 Thomas Sailer (sailer@ife.ee.ethz.ch)
+ *
+ * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * Please note that the GPL allows you to use the driver, NOT the radio.
+ * In order to use the radio, you need a license from the communications
+ * authority of your country.
+ *
+ *
+ * History:
+ * 0.1 26.06.1996 Started
+ * 0.2 11.05.1997 introduced hdrvcomm.h
+ * 0.3 05.01.2000 glibc compile fixes
+ */
+
+/*****************************************************************************/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <errno.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <string.h>
+#include <limits.h>
+#include <net/if.h>
+#include <X11/X.h>
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include "hdrvcomm.h"
+
+/* ---------------------------------------------------------------------- */
+
+static char *progname;
+static Display *display = NULL;
+static Window window;
+static Pixmap pixmap;
+static unsigned long col_zeroline;
+static unsigned long col_background;
+static unsigned long col_trace;
+static GC gr_context;
+static int xmul;
+
+/* ---------------------------------------------------------------------- */
+
+static int x_error_handler(Display *disp, XErrorEvent *evt)
+{
+ char err_buf[256], mesg[256], number[256];
+ char *mtype = "XlibMessage";
+
+ XGetErrorText(disp, evt->error_code, err_buf, sizeof(err_buf));
+ fprintf(stderr, "X Error: %s\n", err_buf);
+ XGetErrorDatabaseText(disp, mtype, "MajorCode", "Request Major code %d",
+ mesg, sizeof(mesg));
+ fprintf(stderr, mesg, evt->request_code);
+ sprintf(number, "%d", evt->request_code);
+ XGetErrorDatabaseText(disp, "XRequest", number, "", err_buf,
+ sizeof(err_buf));
+ fprintf(stderr, " (%s)\n", err_buf);
+ abort();
+}
+
+/* ---------------------------------------------------------------------- */
+
+#define WIDTH 512
+#define HEIGHT (constell ? 512 : 256)
+
+static int openwindow(char *disp, int constell, int samplesperbit)
+{
+ XSetWindowAttributes attr;
+ XGCValues gr_values;
+ XColor color, dummy;
+ XSizeHints sizehints;
+
+ if (!(display = XOpenDisplay(NULL)))
+ return -1;
+ XSetErrorHandler(x_error_handler);
+ XAllocNamedColor(display, DefaultColormap(display, 0), "red",
+ &color, &dummy);
+ col_zeroline = color.pixel;
+ col_background = WhitePixel(display, 0);
+ col_trace = BlackPixel(display, 0);
+ attr.background_pixel = col_background;
+ if (!(window = XCreateWindow(display, XRootWindow(display, 0),
+ 200, 200, WIDTH, HEIGHT, 5,
+ DefaultDepth(display, 0),
+ InputOutput, DefaultVisual(display, 0),
+ CWBackPixel, &attr))) {
+ fprintf(stderr, "smdiag: unable to open X window\n");
+ exit(1);
+ }
+ if (!(pixmap = XCreatePixmap(display, window, WIDTH, HEIGHT,
+ DefaultDepth(display, 0)))) {
+ fprintf(stderr, "smdiag: unable to open offscreen pixmap\n");
+ exit(1);
+ }
+ xmul = WIDTH / (2*(samplesperbit > 0 ? samplesperbit : 1));
+ XSelectInput(display, window, KeyPressMask | StructureNotifyMask
+ | ExposureMask) ;
+ XAllocNamedColor(display, DefaultColormap(display, 0), "red",
+ &color, &dummy);
+ gr_values.foreground = col_trace;
+ gr_values.line_width = 1;
+ gr_values.line_style = LineSolid;
+ gr_context = XCreateGC(display, window, GCForeground | GCLineWidth |
+ GCLineStyle, &gr_values);
+ XStoreName(display, window, "diagnostics");
+ /*
+ * Do not allow the window to be resized
+ */
+ memset(&sizehints, 0, sizeof(sizehints));
+ sizehints.min_width = sizehints.max_width = WIDTH;
+ sizehints.min_height = sizehints.max_height = HEIGHT;
+ sizehints.flags = PMinSize | PMaxSize;
+ XSetWMNormalHints(display, window, &sizehints);
+ XMapWindow(display, window);
+ XSynchronize(display, 1);
+ return 0;
+}
+
+#undef WIDTH
+#undef HEIGHT
+
+/* ---------------------------------------------------------------------- */
+
+static void closewindow(void)
+{
+ if (!display)
+ return;
+ XDestroyWindow(display, window);
+ XCloseDisplay(display);
+ display = NULL;
+}
+
+/* ---------------------------------------------------------------------- */
+
+#define XCOORD(x) ((x) * xm)
+#define YCOORD(y) ((SHRT_MAX - (int)(y)) * winattrs.height / USHRT_MAX)
+
+static void drawdata(short *data, int len, int replace, int xm)
+{
+ int cnt;
+ GC gc;
+ XGCValues gcv;
+ XWindowAttributes winattrs;
+
+ if (!display || !pixmap)
+ return;
+ XGetWindowAttributes(display, window, &winattrs);
+ gcv.line_width = 1;
+ gcv.line_style = LineSolid;
+ gc = XCreateGC(display, pixmap, GCLineWidth | GCLineStyle, &gcv);
+ XSetState(display, gc, col_background, col_background, GXcopy,
+ AllPlanes);
+ if (replace)
+ XFillRectangle(display, pixmap, gc, 0, 0,
+ winattrs.width, winattrs.height);
+ else
+ XCopyArea(display, window, pixmap, gr_context, 0, 0,
+ winattrs.width, winattrs.height, 0, 0);
+ XSetForeground(display, gc, col_trace);
+ for (cnt = 0; cnt < len-1; cnt++)
+ XDrawLine(display, pixmap, gc, XCOORD(cnt), YCOORD(data[cnt]),
+ XCOORD(cnt+1), YCOORD(data[cnt+1]));
+ XSetForeground(display, gc, col_zeroline);
+ XDrawLine(display, pixmap, gc, 0, YCOORD(0), winattrs.width,
+ YCOORD(0));
+ XCopyArea(display, pixmap, window, gr_context, 0, 0, winattrs.width,
+ winattrs.height, 0, 0);
+ XFreeGC(display, gc);
+ XSync(display, 0);
+}
+
+#undef XCOORD
+#undef YCOORD
+
+/* ---------------------------------------------------------------------- */
+
+#define XCOORD(x) ((SHRT_MAX - (int)(x)) * winattrs.width / USHRT_MAX)
+#define YCOORD(y) ((SHRT_MAX - (int)(y)) * winattrs.height / USHRT_MAX)
+
+static void drawconstell(short *data, int len)
+{
+ int cnt;
+ GC gc;
+ XGCValues gcv;
+ XWindowAttributes winattrs;
+
+ if (!display || !pixmap)
+ return;
+ XGetWindowAttributes(display, window, &winattrs);
+ gcv.line_width = 1;
+ gcv.line_style = LineSolid;
+ gc = XCreateGC(display, pixmap, GCLineWidth | GCLineStyle, &gcv);
+ XSetState(display, gc, col_background, col_background, GXcopy,
+ AllPlanes);
+ XCopyArea(display, window, pixmap, gr_context, 0, 0,
+ winattrs.width, winattrs.height, 0, 0);
+ XSetForeground(display, gc, col_trace);
+ for (cnt = 0; cnt < len-1; cnt += 2)
+ XDrawPoint(display, pixmap, gc,
+ XCOORD(data[cnt]), YCOORD(data[cnt+1]));
+ XSetForeground(display, gc, col_zeroline);
+ XDrawLine(display, pixmap, gc, 0, YCOORD(0), winattrs.width, YCOORD(0));
+ XDrawLine(display, pixmap, gc, XCOORD(0), 0, XCOORD(0), winattrs.height);
+ XCopyArea(display, pixmap, window, gr_context, 0, 0, winattrs.width,
+ winattrs.height, 0, 0);
+ XFreeGC(display, gc);
+ XSync(display, 0);
+}
+
+#undef XCOORD
+#undef YCOORD
+
+/* ---------------------------------------------------------------------- */
+
+static void clearwindow(void)
+{
+ XWindowAttributes winattrs;
+ GC gc;
+ XGCValues gcv;
+
+ if (!display || !pixmap)
+ return;
+ XGetWindowAttributes(display, window, &winattrs);
+ gcv.line_width = 1;
+ gcv.line_style = LineSolid;
+ gc = XCreateGC(display, pixmap, GCLineWidth | GCLineStyle, &gcv);
+ XSetState(display, gc, col_background, col_background, GXcopy,
+ AllPlanes);
+ XFillRectangle(display, pixmap, gc, 0, 0,
+ winattrs.width, winattrs.height);
+ XSetForeground(display, gc, col_zeroline);
+ XClearArea(display, window, 0, 0, 0, 0, False);
+ XCopyArea(display, pixmap, window, gr_context, 0, 0, winattrs.width,
+ winattrs.height, 0, 0);
+ XFreeGC(display, gc);
+}
+
+/* ---------------------------------------------------------------------- */
+
+static Bool predicate(Display *display, XEvent *event, char *arg)
+{
+ return True;
+}
+
+/* ---------------------------------------------------------------------- */
+
+static char *getkey(void)
+{
+ XWindowAttributes winattrs;
+ XEvent evt;
+ static char kbuf[32];
+ int i;
+
+ if (!display)
+ return NULL;
+ XSync(display, 0);
+ while (XCheckIfEvent(display, &evt, predicate, NULL)) {
+ switch (evt.type) {
+ case KeyPress:
+ i = XLookupString((XKeyEvent *)&evt, kbuf, sizeof(kbuf)-1,
+ NULL, NULL);
+ if (!i)
+ return NULL;
+ kbuf[i] = 0;
+ return kbuf;
+ case DestroyNotify:
+ XCloseDisplay(display);
+ display = NULL;
+ return NULL;
+ case Expose:
+ XGetWindowAttributes(display, window, &winattrs);
+ XCopyArea(display, pixmap, window, gr_context, 0, 0,
+ winattrs.width, winattrs.height, 0, 0);
+ break;
+ default:
+ break;
+ }
+ }
+ return NULL;
+}
+
+/* ---------------------------------------------------------------------- */
+
+static void printmode(unsigned int mode, unsigned int trigger)
+{
+ printf("Source: %s%s\n", (mode == SM_DIAGMODE_DEMOD) ?
+ "demodulator (eye diagram)" : "input (oscilloscope)",
+ (trigger & SM_DIAGFLAG_DCDGATE) ? " gated with DCD" : "");
+}
+
+/* ---------------------------------------------------------------------- */
+
+static const char *usage_str =
+"[-d display] [-i smif] [-c] [-e]\n"
+" -d: display host\n"
+" -i: specify the name of the baycom kernel driver interface\n"
+" -c: toggle carrier trigger\n"
+" -e: eye diagram mode\n\n"
+" -p: constellation plot\n\n";
+
+int main(int argc, char *argv[])
+{
+ char *disp = NULL;
+ unsigned int mode = HDRVC_DIAGMODE_INPUT;
+ unsigned int trigger = 0;
+ unsigned int ifflags;
+ short data[256];
+ char *cp;
+ int ret;
+ unsigned int samplesperbit;
+
+ progname = *argv;
+ printf("%s: Version 0.2; (C) 1996-1997 by Thomas Sailer HB9JNX/AE4WA\n", *argv);
+ hdrvc_args(&argc, argv, "sm0");
+ while ((ret = getopt(argc, argv, "d:ecp")) != -1) {
+ switch (ret) {
+ case 'd':
+ disp = optarg;
+ break;
+ case 'e':
+ mode = HDRVC_DIAGMODE_DEMOD;
+ trigger = HDRVC_DIAGFLAG_DCDGATE;
+ break;
+ case 'c':
+ trigger ^= HDRVC_DIAGFLAG_DCDGATE;
+ break;
+ case 'p':
+ mode = HDRVC_DIAGMODE_CONSTELLATION;
+ break;
+ default:
+ printf("usage: %s %s", *argv, usage_str);
+ exit(-1);
+ }
+ }
+ hdrvc_init();
+ ifflags = hdrvc_get_ifflags();
+ if (!(ifflags & IFF_UP)) {
+ fprintf(stderr, "interface %s down\n", hdrvc_ifname());
+ exit(1);
+ }
+ if (!(ifflags & IFF_RUNNING)) {
+ fprintf(stderr, "interface %s not running\n", hdrvc_ifname());
+ exit(1);
+ }
+ printmode(mode, trigger);
+ for (;;) {
+ if ((ret = hdrvc_diag2(mode, trigger, data, sizeof(data) / sizeof(short),
+ &samplesperbit)) < 0) {
+ perror("hdrvc_diag2");
+ exit(1);
+ }
+ if (ret > 0) {
+ if (!display) {
+ openwindow(disp, mode == HDRVC_DIAGMODE_CONSTELLATION,
+ samplesperbit);
+ clearwindow();
+ }
+ if (mode == SM_DIAGMODE_CONSTELLATION)
+ drawconstell(data, ret);
+ else
+ drawdata(data, ret, mode == HDRVC_DIAGMODE_INPUT,
+ mode == HDRVC_DIAGMODE_INPUT ? 5:xmul);
+ } else
+ usleep(100000L);
+ if (display) {
+ if ((cp = getkey())) {
+ for (; *cp; cp++) {
+ printf("char pressed: '%c'\n", *cp);
+ switch (*cp) {
+ case 'c':
+ case 'C':
+ clearwindow();
+ printmode(mode, trigger);
+ break;
+ case 'q':
+ case 'Q':
+ closewindow();
+ break;
+ case 'i':
+ case 'I':
+ if (mode == HDRVC_DIAGMODE_CONSTELLATION)
+ break;
+ mode = HDRVC_DIAGMODE_INPUT;
+ clearwindow();
+ printmode(mode, trigger);
+ break;
+ case 'e':
+ case 'E':
+ if (mode == HDRVC_DIAGMODE_CONSTELLATION)
+ break;
+ mode = HDRVC_DIAGMODE_DEMOD;
+ clearwindow();
+ printmode(mode, trigger);
+ break;
+ case 'd':
+ case 'D':
+ trigger ^= HDRVC_DIAGFLAG_DCDGATE;
+ clearwindow();
+ printmode(mode, trigger);
+ break;
+ }
+ }
+ }
+ if (!display)
+ exit(0);
+ }
+ }
+}
+
+/* ---------------------------------------------------------------------- */
diff --git a/hdlcutil/smmixer.c b/hdlcutil/smmixer.c
index 3cfc7e7..fe68422 100644
--- a/hdlcutil/smmixer.c
+++ b/hdlcutil/smmixer.c
@@ -3,7 +3,7 @@
/*
* smmixer.c -- kernel soundcard radio modem driver mixer utility.
*
- * Copyright (C) 1996 Thomas Sailer (sailer@ife.ee.ethz.ch)
+ * Copyright (C) 1996,1997,2000 Thomas Sailer (sailer@ife.ee.ethz.ch)
*
* 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
@@ -25,8 +25,9 @@
*
*
* History:
- * 0.1 26.06.96 Started
- * 0.2 11.05.97 introduced hdrvcomm.h
+ * 0.1 26.06.1996 Started
+ * 0.2 11.05.1997 introduced hdrvcomm.h
+ * 0.3 05.01.2000 glibc compile fixes
*/
/*****************************************************************************/
@@ -41,7 +42,6 @@
#include <net/if.h>
#include "hdrvcomm.h"
-#include <linux/soundmodem.h>
/* ---------------------------------------------------------------------- */
static char *progname;
@@ -56,9 +56,7 @@ static int do_mix_ioctl(int cmd, struct sm_mixer_data *mixdat)
par.cmd = cmd;
par.data.mix = *mixdat;
-#ifdef HDRVC_KERNEL
i = hdrvc_sm_ioctl(cmd, &par);
-#endif
*mixdat = par.data.mix;
return i;
}