From 59cfcb1d81825cc4816fc1ffddd0193f0ebec4ae Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Wed, 11 Apr 2001 08:14:39 +0200 Subject: Import ax25-tools 0.0.6 from tarball --- hdlcutil/fl/Makefile.am | 13 ++ hdlcutil/fl/Makefile.in | 334 ++++++++++++++++++++++++++++ hdlcutil/fl/xfhdlcchpar.cxx | 73 +++++++ hdlcutil/fl/xfhdlcchpar.h | 25 +++ hdlcutil/fl/xfhdlcchpar_main.cxx | 136 ++++++++++++ hdlcutil/fl/xfhdlcst.cxx | 160 ++++++++++++++ hdlcutil/fl/xfhdlcst.h | 31 +++ hdlcutil/fl/xfhdlcst_main.cxx | 177 +++++++++++++++ hdlcutil/fl/xfsmdiag.cxx | 124 +++++++++++ hdlcutil/fl/xfsmdiag.h | 32 +++ hdlcutil/fl/xfsmdiag_main.cxx | 412 ++++++++++++++++++++++++++++++++++ hdlcutil/fl/xfsmdiag_main.h | 70 ++++++ hdlcutil/fl/xfsmmixer.cxx | 437 ++++++++++++++++++++++++++++++++++++ hdlcutil/fl/xfsmmixer.h | 79 +++++++ hdlcutil/fl/xfsmmixer_main.cxx | 462 +++++++++++++++++++++++++++++++++++++++ 15 files changed, 2565 insertions(+) create mode 100644 hdlcutil/fl/Makefile.am create mode 100644 hdlcutil/fl/Makefile.in create mode 100644 hdlcutil/fl/xfhdlcchpar.cxx create mode 100644 hdlcutil/fl/xfhdlcchpar.h create mode 100644 hdlcutil/fl/xfhdlcchpar_main.cxx create mode 100644 hdlcutil/fl/xfhdlcst.cxx create mode 100644 hdlcutil/fl/xfhdlcst.h create mode 100644 hdlcutil/fl/xfhdlcst_main.cxx create mode 100644 hdlcutil/fl/xfsmdiag.cxx create mode 100644 hdlcutil/fl/xfsmdiag.h create mode 100644 hdlcutil/fl/xfsmdiag_main.cxx create mode 100644 hdlcutil/fl/xfsmdiag_main.h create mode 100644 hdlcutil/fl/xfsmmixer.cxx create mode 100644 hdlcutil/fl/xfsmmixer.h create mode 100644 hdlcutil/fl/xfsmmixer_main.cxx (limited to 'hdlcutil/fl') 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 +#include +extern Fl_Window *chpar; +#include +#include +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 +extern void cb_update(Fl_Check_Button*, void*); +extern Fl_Check_Button *fulldup; +#include +extern void cb_quit(Fl_Button*, long); +extern Fl_Button *quit; +#include +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 +#include +#include +#include +#include +#include +#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 +#include +extern Fl_Window *hdlcst; +#include +#include +extern Fl_Round_Button *dcd; +extern Fl_Round_Button *ptt; +#include +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 +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 +#include +#include +#include +#include +#include +#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 +#include +extern Fl_Window *scopewindow; +#include +#include "xfsmdiag_main.h" +extern scope *scdisp; +#include +extern void cb_cleargr(Fl_Button*, long); +extern Fl_Button *cleargr; +#include +extern Fl_Group *scopemode; +#include +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 +extern Fl_Round_Button *st_dcd; +extern Fl_Round_Button *st_ptt; +#include +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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "hdrvcomm.h" +#include "xfsmdiag.h" +#include +#include + +/* ---------------------------------------------------------------------- */ + +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 +#include +#include + +/* ---------------------------------------------------------------------- */ + +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 +#include +extern Fl_Window *mixer_ad1848; +#include +#include +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 +extern void cb_quit(Fl_Button*, long); +extern Fl_Button *ad1848_quit; +#include +extern Fl_Group *ad1848_srcr; +#include +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 +#include +#include +#include +#include +//#include +#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); +} -- cgit v1.2.3