summaryrefslogtreecommitdiffstats
path: root/hdlcutil
diff options
context:
space:
mode:
Diffstat (limited to 'hdlcutil')
-rw-r--r--hdlcutil/Makefile.am13
-rw-r--r--hdlcutil/Makefile.in26
-rw-r--r--hdlcutil/setcrystal.c2
-rw-r--r--hdlcutil/smdiag.878
-rw-r--r--hdlcutil/smdiag.c434
5 files changed, 7 insertions, 546 deletions
diff --git a/hdlcutil/Makefile.am b/hdlcutil/Makefile.am
index effca5e..3584a38 100644
--- a/hdlcutil/Makefile.am
+++ b/hdlcutil/Makefile.am
@@ -1,9 +1,9 @@
installconf:
-sbin_PROGRAMS = setcrystal sethdlc smmixer smdiag
+sbin_PROGRAMS = setcrystal sethdlc smmixer
-man_MANS = sethdlc.8 smdiag.8 smmixer.8 baycom.9 hdlcdrv.9 soundmodem.9
+man_MANS = sethdlc.8 smmixer.8 baycom.9 hdlcdrv.9 soundmodem.9
EXTRA_DIST = $(man_MANS)
@@ -22,12 +22,3 @@ smmixer_SOURCES = \
hdrvcomm.h \
usersmdiag.h
-smdiag_SOURCES = \
- smdiag.c \
- hdrvcomm.c \
- hdrvcomm.h \
- usersmdiag.h
-
-smdiag_LDADD = \
- $(X_LIBS) \
- -lX11
diff --git a/hdlcutil/Makefile.in b/hdlcutil/Makefile.in
index a0d16f9..1583b42 100644
--- a/hdlcutil/Makefile.in
+++ b/hdlcutil/Makefile.in
@@ -68,9 +68,9 @@ UTIL_LIB = @UTIL_LIB@
VERSION = @VERSION@
Z_LIB = @Z_LIB@
-sbin_PROGRAMS = setcrystal sethdlc smmixer smdiag
+sbin_PROGRAMS = setcrystal sethdlc smmixer
-man_MANS = sethdlc.8 smdiag.8 smmixer.8 baycom.9 hdlcdrv.9 soundmodem.9
+man_MANS = sethdlc.8 smmixer.8 baycom.9 hdlcdrv.9 soundmodem.9
EXTRA_DIST = $(man_MANS)
@@ -82,12 +82,6 @@ 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
-
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../config.h
CONFIG_CLEAN_FILES =
@@ -114,9 +108,6 @@ 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)
@@ -133,8 +124,8 @@ DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = tar
GZIP_ENV = --best
-SOURCES = $(setcrystal_SOURCES) $(sethdlc_SOURCES) $(smmixer_SOURCES) $(smdiag_SOURCES)
-OBJECTS = $(setcrystal_OBJECTS) $(sethdlc_OBJECTS) $(smmixer_OBJECTS) $(smdiag_OBJECTS)
+SOURCES = $(setcrystal_SOURCES) $(sethdlc_SOURCES) $(smmixer_SOURCES)
+OBJECTS = $(setcrystal_OBJECTS) $(sethdlc_OBJECTS) $(smmixer_OBJECTS)
all: all-redirect
.SUFFIXES:
@@ -203,10 +194,6 @@ 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)'; \
@@ -323,11 +310,6 @@ distdir: $(DISTFILES)
|| cp -p $$d/$$file $(distdir)/$$file || :; \
fi; \
done
-hdrvcomm.o: hdrvcomm.c hdrvcomm.h usersmdiag.h
-setcrystal.o: setcrystal.c
-sethdlc.o: sethdlc.c hdrvcomm.h
-smdiag.o: smdiag.c hdrvcomm.h
-smmixer.o: smmixer.c hdrvcomm.h
info-am:
info: info-am
diff --git a/hdlcutil/setcrystal.c b/hdlcutil/setcrystal.c
index f5181f3..48ee750 100644
--- a/hdlcutil/setcrystal.c
+++ b/hdlcutil/setcrystal.c
@@ -30,7 +30,7 @@
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
-#include <asm/io.h>
+#include <sys/io.h>
/* --------------------------------------------------------------------- */
diff --git a/hdlcutil/smdiag.8 b/hdlcutil/smdiag.8
deleted file mode 100644
index 276a1b7..0000000
--- a/hdlcutil/smdiag.8
+++ /dev/null
@@ -1,78 +0,0 @@
-.\" 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
deleted file mode 100644
index d8a20f8..0000000
--- a/hdlcutil/smdiag.c
+++ /dev/null
@@ -1,434 +0,0 @@
-/*****************************************************************************/
-
-/*
- * smdiag.c -- kernel soundcard radio modem driver diagnostics 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.
- *
- *
- * History:
- * 0.1 26.06.96 Started
- * 0.2 11.05.97 introduced hdrvcomm.h
- */
-
-/*****************************************************************************/
-
-#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"
-
-#include <linux/soundmodem.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();
-#ifdef HDRVC_KERNEL
- 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);
- }
-#endif /* HDRVC_KERNEL */
- 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);
- }
- }
-}
-
-/* ---------------------------------------------------------------------- */