summaryrefslogtreecommitdiffstats
path: root/gnu/usr.sbin/isdn/dbg
diff options
context:
space:
mode:
authorjkh <jkh@FreeBSD.org>1995-02-15 00:46:26 +0000
committerjkh <jkh@FreeBSD.org>1995-02-15 00:46:26 +0000
commit0cb129cc755064f31fb42abf2c721a8605381511 (patch)
tree87521af8f33d69817699aec072374bf2d3734e3e /gnu/usr.sbin/isdn/dbg
downloadFreeBSD-src-0cb129cc755064f31fb42abf2c721a8605381511.zip
FreeBSD-src-0cb129cc755064f31fb42abf2c721a8605381511.tar.gz
Import the ISDN userland utilities. Just about ready to start shaking
this baby out in earnest..
Diffstat (limited to 'gnu/usr.sbin/isdn/dbg')
-rw-r--r--gnu/usr.sbin/isdn/dbg/Makefile5
-rw-r--r--gnu/usr.sbin/isdn/dbg/dbg.119
-rw-r--r--gnu/usr.sbin/isdn/dbg/dbg.c63
-rw-r--r--gnu/usr.sbin/isdn/dbg/dbg_3008.c150
-rw-r--r--gnu/usr.sbin/isdn/dbg/dbg_3009.c151
-rw-r--r--gnu/usr.sbin/isdn/dbg/dbg_5000.c136
6 files changed, 524 insertions, 0 deletions
diff --git a/gnu/usr.sbin/isdn/dbg/Makefile b/gnu/usr.sbin/isdn/dbg/Makefile
new file mode 100644
index 0000000..7b1e33d
--- /dev/null
+++ b/gnu/usr.sbin/isdn/dbg/Makefile
@@ -0,0 +1,5 @@
+CFLAGS+= -DBSD -O
+PROG= dbg
+SRCS= dbg.c dbg_3009.c dbg_3008.c dbg_5000.c
+
+.include <bsd.prog.mk>
diff --git a/gnu/usr.sbin/isdn/dbg/dbg.1 b/gnu/usr.sbin/isdn/dbg/dbg.1
new file mode 100644
index 0000000..b40548e
--- /dev/null
+++ b/gnu/usr.sbin/isdn/dbg/dbg.1
@@ -0,0 +1,19 @@
+.\" Copyright (c) 1994 Dietmar Friede
+.Dd September 15, 1994
+.Os BSD
+.Dt "ISDN dbg" 1
+.Sh NAME
+.Nm dbg
+.Nd NICCY-3008, NICCY-3009, NICCY-5000 debug programm
+.Sh SYNOPSIS
+.Nm dbg
+.Op file
+.Sh DESCRIPTION
+.Nm
+reads the shared memory of the NICCY-3008 and the NICCY-3009 or the status
+bytes of the NICCY-5000 and displays them. The output is send to stderr.
+If you give a filename the bytes are dumped to this file.
+.Sh BUGS
+.Nm
+is only working correctly for the 3008. Some of the output for the 3009
+and 5000 are interpreted wrong.
diff --git a/gnu/usr.sbin/isdn/dbg/dbg.c b/gnu/usr.sbin/isdn/dbg/dbg.c
new file mode 100644
index 0000000..b57b5c7
--- /dev/null
+++ b/gnu/usr.sbin/isdn/dbg/dbg.c
@@ -0,0 +1,63 @@
+static char rcsid[] = "@(#)$Id: dbg.c,v 1.1 1995/01/25 14:06:18 jkr Exp jkr $";
+/*******************************************************************************
+ * II - Version 0.1 $Revision: 1.1 $ $State: Exp $
+ *
+ * Copyright 1994 Dietmar Friede
+ *******************************************************************************
+ * Bug reports, patches, comments, suggestions should be sent to:
+ *
+ * jkr@saarlink.de or jkrause@guug.de
+ *
+ *******************************************************************************
+ * $Log: dbg.c,v $
+ *
+ ******************************************************************************/
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/ioctl.h>
+#include <sys/file.h>
+#include "../../../../sys/gnu/i386/isa/niccyreg.h"
+
+u_char data[10000];
+int f;
+FILE *Fout;
+
+main(int argc, char **argv)
+{
+ int size = 0;
+
+ if ((f = open("/dev/nic0", O_RDWR)) < 0)
+ {
+ perror("open");
+ exit(1);
+ }
+ if (ioctl(f, NICCY_DEBUG, data) < 0)
+ {
+ perror("ioctl");
+ }
+ switch (data[0])
+ {
+ case 0x38:
+ printf("Niccy 3008\n");
+ analyse_3008(data + 1);
+ size = 1024;
+ break;
+ case 0x39:
+ printf("Niccy 3009\n");
+ analyse_3009(data + 1);
+ size = 2044;
+ break;
+ case 0x50:
+ printf("Niccy 5000\n");
+ analyse_5000(data + 1);
+ size = 8;
+ break;
+ default:
+ printf("unknown\n");
+ }
+
+ argv++;
+ if (*argv && (Fout = fopen(*argv, "w")) != NULL && size)
+ fwrite(data + 1, size, 1, Fout);
+}
diff --git a/gnu/usr.sbin/isdn/dbg/dbg_3008.c b/gnu/usr.sbin/isdn/dbg/dbg_3008.c
new file mode 100644
index 0000000..9452572
--- /dev/null
+++ b/gnu/usr.sbin/isdn/dbg/dbg_3008.c
@@ -0,0 +1,150 @@
+static char rcsid[] = "@(#)$Id: dbg_3008.c,v 1.1 1995/01/25 14:06:18 jkr Exp jkr $";
+/*******************************************************************************
+ * II - Version 0.1 $Revision: 1.1 $ $State: Exp $
+ *
+ * Copyright 1994 Dietmar Friede
+ *******************************************************************************
+ * Bug reports, patches, comments, suggestions should be sent to:
+ *
+ * jkr@saarlink.de or jkrause@guug.de
+ *
+ *******************************************************************************
+ * $Log: dbg_3008.c,v $
+ *
+ ******************************************************************************/
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/ioctl.h>
+#include <sys/file.h>
+#include "../../../../sys/gnu/i386/isa/nic3008.h"
+
+static int
+print_stat(status)
+{
+ if (status & 0x8A)
+ {
+ if (status & 0x80)
+ fprintf(stderr, "Software-Fehler\n");
+ if (status & 8)
+ fprintf(stderr, "Hardware-Fehler\n");
+ if (status & 2)
+ fprintf(stderr, "Fehler beim Selbsttest\n");
+ }
+}
+
+static int
+self_test(dpr_type * dpr)
+{
+ int abort;
+
+}
+
+static int
+prtint(i)
+{
+ switch (i)
+ {
+ case 0:fprintf(stderr, "5");
+ break;
+ case 1:
+ fprintf(stderr, "4");
+ break;
+ case 2:
+ fprintf(stderr, "3");
+ break;
+ case 3:
+ fprintf(stderr, "2/9");
+ break;
+ case 4:
+ fprintf(stderr, "7");
+ break;
+ default:
+ fprintf(stderr, "??????????\n");
+ }
+ fprintf(stderr, "\n");
+}
+
+analyse_3008(dpr_type * dpr)
+{
+
+ print_stat(dpr->card_state);
+ if (dpr->card_state & 1)
+ {
+ fprintf(stderr, "Selbsttest lae„uf\n");
+ exit(1);
+ }
+ self_test(dpr);
+ fprintf(stderr, "%s : %x %x %x %x\n", dpr->niccy_ver, dpr->card_state
+ ,dpr->hw_config, dpr->jmp_config, dpr->ram_config);
+ if (dpr->card_state & 4)
+ fprintf(stderr, "Layer 1 not active\n");
+ if (dpr->card_state & 0x10)
+ fprintf(stderr, "Date/Time not set\n");
+ if (dpr->card_state & 0x20)
+ fprintf(stderr, "ENTITY not loaded\n");
+ if (dpr->card_state & 0x40)
+ fprintf(stderr, "out of sync.\n");
+ fprintf(stderr, "Hardware Configuration:\n");
+ if (dpr->hw_config & 0x80)
+ fprintf(stderr, "No ");
+ fprintf(stderr, "DRAM-Module\n");
+ if (dpr->ram_config & 1)
+ fprintf(stderr, "256 KB SRAM\n");
+ switch (dpr->ram_config)
+ {
+ case 4:
+ case 5:
+ fprintf(stderr, "1 MB DRAM\n");
+ break;
+ case 16:
+ case 17:
+ fprintf(stderr, "1 MB DRAM\n");
+ }
+ switch ((dpr->hw_config >> 5) & 3)
+ {
+ case 3:
+ fprintf(stderr, "Modem Module\n");
+ break;
+ case 0:
+ break;
+ default:
+ fprintf(stderr, "??????????\n");
+ }
+ switch ((dpr->hw_config >> 3) & 3)
+ {
+ case 3:
+ fprintf(stderr, "Telefon Module\n");
+ break;
+ case 2:
+ fprintf(stderr, "X Interface\n");
+ break;
+ case 0:
+ break;
+ default:
+ fprintf(stderr, "??????????\n");
+ }
+ switch (dpr->hw_config & 7)
+ {
+ case 7:
+ fprintf(stderr, "S0 Module\n");
+ break;
+ case 6:
+ fprintf(stderr, "Uk0 Module\n");
+ break;
+ case 5:
+ fprintf(stderr, "Up0 Module\n");
+ break;
+ case 0:
+ break;
+ default:
+ fprintf(stderr, "??????????\n");
+ }
+
+ fprintf(stderr, "Jumper:\n");
+ fprintf(stderr, "COM%d\n", ((dpr->jmp_config >> 6) & 3) + 1);
+ fprintf(stderr, "DPRAM-IRQ");
+ prtint((dpr->jmp_config >> 3) & 7);
+ fprintf(stderr, "COM-IRQ");
+ prtint(dpr->jmp_config & 7);
+}
diff --git a/gnu/usr.sbin/isdn/dbg/dbg_3009.c b/gnu/usr.sbin/isdn/dbg/dbg_3009.c
new file mode 100644
index 0000000..eee5932
--- /dev/null
+++ b/gnu/usr.sbin/isdn/dbg/dbg_3009.c
@@ -0,0 +1,151 @@
+static char rcsid[] = "@(#)$Id: dbg_3009.c,v 1.1 1995/01/25 14:06:18 jkr Exp jkr $";
+/*******************************************************************************
+ * II - Version 0.1 $Revision: 1.1 $ $State: Exp $
+ *
+ * Copyright 1994 Dietmar Friede
+ *******************************************************************************
+ * Bug reports, patches, comments, suggestions should be sent to:
+ *
+ * jkr@saarlink.de or jkrause@guug.de
+ *
+ *******************************************************************************
+ * $Log: dbg_3009.c,v $
+ *
+ ******************************************************************************/
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/ioctl.h>
+#include <sys/file.h>
+#include "../../../../sys/gnu/i386/isa/nic3009.h"
+
+static int
+print_stat(status)
+{
+ if (status & 0x8A)
+ {
+ if (status & 0x80)
+ fprintf(stderr, "Software-Fehler\n");
+ if (status & 8)
+ fprintf(stderr, "Hardware-Fehler\n");
+ if (status & 2)
+ fprintf(stderr, "Fehler beim Selbsttest\n");
+ }
+}
+
+static int
+prtint(i)
+{
+ switch (i)
+ {
+ case 0:fprintf(stderr, "5");
+ break;
+ case 1:
+ fprintf(stderr, "4");
+ break;
+ case 2:
+ fprintf(stderr, "3");
+ break;
+ case 3:
+ fprintf(stderr, "2/9");
+ break;
+ case 4:
+ fprintf(stderr, "7");
+ break;
+ default:
+ fprintf(stderr, "??????????\n");
+ }
+ fprintf(stderr, "\n");
+}
+
+static
+mbx_analyse(mbx_type * mbx)
+{
+ printf("Type %x SubType %x no %x", mbx->type, mbx->subtype, mbx->number);
+ if (mbx->more_data)
+ printf(" more");
+ printf(" len %d plci %x\n", mbx->data_len, mbx->plci);
+}
+
+analyse_3009(dpr_type * dpr)
+{
+ fprintf(stderr, "card state %x hw conf %x ram conf %x\n", dpr->card_state
+ ,dpr->hw_config, dpr->ram_config);
+ print_stat(dpr->card_state);
+ if (dpr->card_state & 4)
+ fprintf(stderr, "Layer 1 not active\n");
+ if (dpr->card_state & 0x10)
+ fprintf(stderr, "Date/Time not set\n");
+ if (dpr->card_state & 0x20)
+ fprintf(stderr, "ENTITY not loaded\n");
+ if (dpr->card_state & 0x40)
+ fprintf(stderr, "out of sync.\n");
+ fprintf(stderr, "Hardware Configuration:\n");
+ if (dpr->hw_config & 0x80)
+ fprintf(stderr, "No ");
+ /*
+ * fprintf(stderr,"DRAM-Module\n"); if(dpr->ram_config&1)
+ * fprintf(stderr,"256 KB SRAM\n"); switch(dpr->ram_config) { case 4:
+ * case 5: fprintf(stderr,"1 MB DRAM\n"); break; case 16: case 17:
+ * fprintf(stderr,"1 MB DRAM\n"); }
+ */
+ switch ((dpr->hw_config >> 5) & 3)
+ {
+ case 3:
+ fprintf(stderr, "Modem Module\n");
+ break;
+ case 0:
+ break;
+ default:
+ fprintf(stderr, "??????????\n");
+ }
+ switch ((dpr->hw_config >> 3) & 3)
+ {
+ case 3:
+ fprintf(stderr, "Telefon Module\n");
+ break;
+ case 2:
+ fprintf(stderr, "X Interface\n");
+ break;
+ case 0:
+ break;
+ default:
+ fprintf(stderr, "??????????\n");
+ }
+ switch (dpr->hw_config & 7)
+ {
+ case 7:
+ fprintf(stderr, "S0 Module\n");
+ break;
+ case 6:
+ fprintf(stderr, "Uk0 Module\n");
+ break;
+ case 5:
+ fprintf(stderr, "Up0 Module\n");
+ break;
+ case 0:
+ break;
+ default:
+ fprintf(stderr, "??????????\n");
+ }
+ if (dpr->up_mbx.msg_flag)
+ {
+ printf("Up Mailbox activ:\n");
+ mbx_analyse(&dpr->up_mbx);
+ }
+ if (dpr->dn_mbx.msg_flag)
+ {
+ printf("Down Mailbox activ:\n");
+ mbx_analyse(&dpr->dn_mbx);
+ }
+ if (dpr->up_mbx.msg_flag == 0)
+ {
+ printf("Up Mailbox not activ:\n");
+ mbx_analyse(&dpr->up_mbx);
+ }
+ if (dpr->dn_mbx.msg_flag == 0)
+ {
+ printf("Down Mailbox not activ:\n");
+ mbx_analyse(&dpr->dn_mbx);
+ }
+}
diff --git a/gnu/usr.sbin/isdn/dbg/dbg_5000.c b/gnu/usr.sbin/isdn/dbg/dbg_5000.c
new file mode 100644
index 0000000..8711232
--- /dev/null
+++ b/gnu/usr.sbin/isdn/dbg/dbg_5000.c
@@ -0,0 +1,136 @@
+static char rcsid[] = "@(#)$Id: dbg_5000.c,v 1.1 1995/01/25 14:06:18 jkr Exp jkr $";
+/*******************************************************************************
+ * II - Version 0.1 $Revision: 1.1 $ $State: Exp $
+ *
+ * Copyright 1994 Dietmar Friede
+ *******************************************************************************
+ * Bug reports, patches, comments, suggestions should be sent to:
+ *
+ * jkr@saarlink.de or jkrause@guug.de
+ *
+ *******************************************************************************
+ * $Log: dbg_5000.c,v $
+ *
+ ******************************************************************************/
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/ioctl.h>
+#include <sys/file.h>
+
+static int
+prtint(i)
+{
+ switch (i)
+ {
+ case 0:fprintf(stderr, "5");
+ break;
+ case 1:
+ fprintf(stderr, "4");
+ break;
+ case 2:
+ fprintf(stderr, "3");
+ break;
+ case 3:
+ fprintf(stderr, "2/9");
+ break;
+ case 4:
+ fprintf(stderr, "7");
+ break;
+ default:
+ fprintf(stderr, "??????????\n");
+ }
+ fprintf(stderr, "\n");
+}
+
+static int
+print_stat(status)
+{
+ if (status & 0x8A)
+ {
+ if (status & 0x80)
+ fprintf(stderr, "Software-Fehler\n");
+ if (status & 8)
+ fprintf(stderr, "Hardware-Fehler\n");
+ if (status & 2)
+ fprintf(stderr, "Fehler beim Selbsttest\n");
+ }
+}
+
+analyse_5000(unsigned char *data)
+{
+ print_stat(data[1]);
+
+ fprintf(stderr, "%x %x %x %x\n", data[1]
+ ,data[5], data[6], data[7]);
+ if (data[1] & 4)
+ fprintf(stderr, "Layer 1 not active\n");
+ if (data[1] & 0x10)
+ fprintf(stderr, "Date/Time not set\n");
+ if (data[1] & 0x20)
+ fprintf(stderr, "ENTITY not loaded\n");
+ if (data[1] & 0x40)
+ fprintf(stderr, "out of sync.\n");
+ fprintf(stderr, "Hardware Configuration:\n");
+ if (data[5] & 0x80)
+ fprintf(stderr, "No ");
+ fprintf(stderr, "DRAM-Module\n");
+ if (data[7] & 1)
+ fprintf(stderr, "256 KB SRAM\n");
+ switch (data[7])
+ {
+ case 4:
+ case 5:
+ fprintf(stderr, "1 MB DRAM\n");
+ break;
+ case 16:
+ case 17:
+ fprintf(stderr, "1 MB DRAM\n");
+ }
+ switch ((data[5] >> 5) & 3)
+ {
+ case 3:
+ fprintf(stderr, "Modem Module\n");
+ break;
+ case 0:
+ break;
+ default:
+ fprintf(stderr, "??????????\n");
+ }
+ switch ((data[5] >> 3) & 3)
+ {
+ case 3:
+ fprintf(stderr, "Telefon Module\n");
+ break;
+ case 2:
+ fprintf(stderr, "X Interface\n");
+ break;
+ case 0:
+ break;
+ default:
+ fprintf(stderr, "??????????\n");
+ }
+ switch (data[5] & 7)
+ {
+ case 7:
+ fprintf(stderr, "S0 Module\n");
+ break;
+ case 6:
+ fprintf(stderr, "Uk0 Module\n");
+ break;
+ case 5:
+ fprintf(stderr, "Up0 Module\n");
+ break;
+ case 0:
+ break;
+ default:
+ fprintf(stderr, "??????????\n");
+ }
+
+ fprintf(stderr, "Jumper:\n");
+ fprintf(stderr, "COM%d\n", ((data[6] >> 6) & 3) + 1);
+ fprintf(stderr, "DPRAM-IRQ");
+ prtint((data[6] >> 3) & 7);
+ fprintf(stderr, "COM-IRQ");
+ prtint(data[6] & 7);
+}
OpenPOWER on IntegriCloud