347 lines
20 KiB
Plaintext
347 lines
20 KiB
Plaintext
<HTML>
|
|
|
|
<!-- Generated by c2html-1.0, Copyright 1998 by Dave Whittington -->
|
|
<HEAD>
|
|
<TITLE>debugvar.c</TITLE>
|
|
<!--#include virtual="/ssi/js.shtml" -->
|
|
<!--#include virtual="/ssi/buttondefs.shtml" -->
|
|
</HEAD>
|
|
<BODY BGCOLOR="#FFFFFF">
|
|
<TABLE WIDTH="100%">
|
|
<TR>
|
|
<TD ALIGN=LEFT WIDTH="90"><!--#include virtual="/ssi/b_home.shtml" --></TD>
|
|
<TD ALIGN=RIGHT WIDTH="90"><!--#include virtual="/ssi/b_index.shtml" --></TD>
|
|
</TR>
|
|
</TABLE>
|
|
<CENTER><H1>debugvar.c</H1></CENTER>
|
|
|
|
<HR>
|
|
<PRE>
|
|
<FONT COLOR=#0000FF>/* $Id$
|
|
|
|
* Variable-debugging for isdn4linux.
|
|
*
|
|
* Copyright 1994 by Fritz Elfert (fritz@wuemaus.franken.de)
|
|
* Copyright 1995 Thinking Objects Software GmbH Wuerzburg
|
|
*
|
|
* This file is part of Isdn4Linux.
|
|
*
|
|
* 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, 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.
|
|
*
|
|
* $Log$
|
|
* Revision 1.5 1997/02/03 23:34:51 fritz
|
|
* Reformatted
|
|
*
|
|
* Revision 1.4 1996/04/30 07:55:50 fritz
|
|
* Disabled mmap.
|
|
*
|
|
* Revision 1.3 1996/04/28 15:19:23 fritz
|
|
* adapted to new ioctl names.
|
|
*
|
|
* Revision 1.2 1996/01/04 02:46:16 fritz
|
|
* Changed copying policy to GPL.
|
|
*
|
|
* Revision 1.1 1995/12/18 18:22:52 fritz
|
|
* Initial revision
|
|
*
|
|
*/</FONT>
|
|
|
|
<FONT COLOR=#A521F7>#include</FONT> <sys/types.h>
|
|
<FONT COLOR=#A521F7>#include</FONT> <sys/fcntl.h>
|
|
<FONT COLOR=#0000FF>/* #include <sys/mman.h> */</FONT>
|
|
<FONT COLOR=#A521F7>#include</FONT> <stdio.h>
|
|
<FONT COLOR=#A521F7>#include</FONT> <stdlib.h>
|
|
<FONT COLOR=#A521F7>#include</FONT> <unistd.h>
|
|
<FONT COLOR=#A521F7>#include</FONT> <sys/ioctl.h>
|
|
|
|
<FONT COLOR=#A521F7>#include</FONT> <linux/isdn.h>
|
|
<FONT COLOR=#A521F7>#include</FONT> <linux/isdnif.h>
|
|
|
|
<FONT COLOR="#298C52">typedef</FONT> <FONT COLOR="#298C52">unsigned</FONT> <FONT COLOR="#298C52">char</FONT> <A NAME="uchar">uchar</A>;
|
|
<FONT COLOR="#298C52">int</FONT> mem_fd;
|
|
|
|
<FONT COLOR=#A521F7>#if</FONT> 0 <FONT COLOR=#0000FF>/* Weiss der Teufel, warum das nicht mit mmap geht */</FONT>
|
|
<A HREF="#uchar">uchar</A>
|
|
* <A NAME="mapmem">mapmem</A>(ulong location, <FONT COLOR="#298C52">long</FONT> size)
|
|
{
|
|
ulong mmseg;
|
|
ulong mmsize;
|
|
ulong addr;
|
|
ulong offset;
|
|
|
|
mmseg = location & 0xffffe000L;
|
|
mmsize = (location - mmseg + size) + 0x1000;
|
|
offset = location - mmseg;
|
|
addr = (ulong) mmap(0, mmsize, PROT_READ, MAP_SHARED, mem_fd, mmseg);
|
|
<FONT COLOR="#298C52">if</FONT> ((<FONT COLOR="#298C52">int</FONT>) addr == -1) {
|
|
perror(<FONT COLOR="#FF0000">"mmap"</FONT>);
|
|
exit(1);
|
|
}
|
|
printf(<FONT COLOR="#FF0000">"mmap: loc=%08lx siz=%08lx mseg=%08lx msiz=%08lx ofs=%08lx adr=%08lx\n"</FONT>, location, size, mmseg, mmsize, offset, addr);
|
|
<FONT COLOR="#298C52">return</FONT> ((<A HREF="#uchar">uchar</A> *) (addr + offset));
|
|
}
|
|
<FONT COLOR=#A521F7>#else</FONT>
|
|
<A HREF="#uchar">uchar</A>
|
|
* <A NAME="mapmem">mapmem</A>(ulong location, <FONT COLOR="#298C52">long</FONT> size)
|
|
{
|
|
<A HREF="#uchar">uchar</A> *buffer;
|
|
|
|
<FONT COLOR="#298C52">if</FONT> ((buffer = malloc(size))) {
|
|
lseek(mem_fd, location, SEEK_SET);
|
|
read(mem_fd, buffer, size);
|
|
} <FONT COLOR="#298C52">else</FONT> {
|
|
perror(<FONT COLOR="#FF0000">"malloc"</FONT>);
|
|
exit(1);
|
|
}
|
|
<FONT COLOR="#298C52">return</FONT> buffer;
|
|
}
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
|
|
<FONT COLOR="#298C52">char</FONT> *
|
|
<A NAME="dumpIntArray">dumpIntArray</A>(<FONT COLOR="#298C52">int</FONT> *arr, <FONT COLOR="#298C52">int</FONT> count)
|
|
{
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">char</FONT> buf[1024];
|
|
<FONT COLOR="#298C52">char</FONT> *p = buf;
|
|
<FONT COLOR="#298C52">int</FONT> i;
|
|
|
|
<FONT COLOR="#298C52">for</FONT> (i = 0; i < count; i++)
|
|
p += sprintf(p, <FONT COLOR="#FF0000">"%d%s"</FONT>, arr[i], (i < (count - 1)) ? <FONT COLOR="#FF0000">", "</FONT> : <FONT COLOR="#FF0000">"\0"</FONT>);
|
|
<FONT COLOR="#298C52">return</FONT> (buf);
|
|
}
|
|
|
|
<FONT COLOR="#298C52">char</FONT> *
|
|
<A NAME="dumpCharArray">dumpCharArray</A>(<FONT COLOR="#298C52">char</FONT> *arr, <FONT COLOR="#298C52">int</FONT> count)
|
|
{
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">char</FONT> buf[1024];
|
|
<FONT COLOR="#298C52">char</FONT> *p = buf;
|
|
<FONT COLOR="#298C52">int</FONT> i;
|
|
|
|
<FONT COLOR="#298C52">for</FONT> (i = 0; i < count; i++)
|
|
p += sprintf(p, <FONT COLOR="#FF0000">"%02x%s"</FONT>, (<A HREF="#uchar">uchar</A>) arr[i], (i < (count - 1)) ? <FONT COLOR="#FF0000">", "</FONT> : <FONT COLOR="#FF0000">"\0"</FONT>);
|
|
<FONT COLOR="#298C52">return</FONT> (buf);
|
|
}
|
|
|
|
<FONT COLOR="#298C52">char</FONT> *
|
|
<A NAME="dumpStringArray">dumpStringArray</A>(<FONT COLOR="#298C52">char</FONT> *arr, <FONT COLOR="#298C52">int</FONT> count, <FONT COLOR="#298C52">int</FONT> len)
|
|
{
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">char</FONT> buf[1024];
|
|
<FONT COLOR="#298C52">char</FONT> *p = buf;
|
|
<FONT COLOR="#298C52">char</FONT> *s = arr;
|
|
<FONT COLOR="#298C52">int</FONT> i;
|
|
|
|
<FONT COLOR="#298C52">for</FONT> (i = 0; i < count; s += len, i++)
|
|
p += sprintf(p, <FONT COLOR="#FF0000">"\"%s\"%s"</FONT>, s, (i < (count - 1)) ? <FONT COLOR="#FF0000">", "</FONT> : <FONT COLOR="#FF0000">"\0"</FONT>);
|
|
<FONT COLOR="#298C52">return</FONT> (buf);
|
|
}
|
|
|
|
<FONT COLOR="#298C52">void</FONT>
|
|
<A NAME="dumpDriver">dumpDriver</A>(ulong drvaddr)
|
|
{
|
|
<A HREF="../includes/isdn.h.shtml#driver">driver</A> *drv = (<A HREF="../includes/isdn.h.shtml#driver">driver</A> *) <A HREF="#mapmem">mapmem</A>(drvaddr, <FONT COLOR="#298C52">sizeof</FONT>(<A HREF="../includes/isdn.h.shtml#driver">driver</A>));
|
|
<A HREF="../includes/isdnif.h.shtml#isdn_if">isdn_if</A> *ifc = (<A HREF="../includes/isdnif.h.shtml#isdn_if">isdn_if</A> *) <A HREF="#mapmem">mapmem</A>((ulong) drv->interface, <FONT COLOR="#298C52">sizeof</FONT>(<A HREF="../includes/isdnif.h.shtml#isdn_if">isdn_if</A>));
|
|
|
|
printf(<FONT COLOR="#FF0000">" flags = %08lx\n"</FONT>, drv->flags);
|
|
printf(<FONT COLOR="#FF0000">" channels = %d\n"</FONT>, drv->channels);
|
|
printf(<FONT COLOR="#FF0000">" reject_bus = %d\n"</FONT>, drv->reject_bus);
|
|
printf(<FONT COLOR="#FF0000">" maxbufsize = %d\n"</FONT>, drv->maxbufsize);
|
|
printf(<FONT COLOR="#FF0000">" pktcount = %ld\n"</FONT>, drv->pktcount);
|
|
printf(<FONT COLOR="#FF0000">" running = %d\n"</FONT>, drv->running);
|
|
printf(<FONT COLOR="#FF0000">" loaded = %d\n"</FONT>, drv->loaded);
|
|
printf(<FONT COLOR="#FF0000">" stavail = %d\n"</FONT>, drv->stavail);
|
|
printf(<FONT COLOR="#FF0000">" Interface @%08lx:\n"</FONT>, (ulong) drv->interface);
|
|
printf(<FONT COLOR="#FF0000">" Id(ch) = %d\n"</FONT>, ifc->channels);
|
|
printf(<FONT COLOR="#FF0000">" maxbufsize = %d\n"</FONT>, ifc->maxbufsize);
|
|
printf(<FONT COLOR="#FF0000">" features = %08lx\n"</FONT>, ifc->features);
|
|
}
|
|
|
|
<FONT COLOR="#298C52">void</FONT>
|
|
<A NAME="dumpModem">dumpModem</A>(<A HREF="../includes/isdn.h.shtml#modem">modem</A> mdm)
|
|
{
|
|
<FONT COLOR="#298C52">int</FONT> i;
|
|
<A HREF="../includes/isdn.h.shtml#atemu">atemu</A> *atm;
|
|
<A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> *info;
|
|
|
|
<FONT COLOR="#298C52">for</FONT> (i = 0; i < <A HREF="../includes/isdn.h.shtml#ISDN_MAX_CHANNELS">ISDN_MAX_CHANNELS</A>; i++) {
|
|
printf(<FONT COLOR="#FF0000">"mdm [%02d]\n"</FONT>, i);
|
|
printf(<FONT COLOR="#FF0000">" msr = %08x\n"</FONT>, mdm.msr[i]);
|
|
printf(<FONT COLOR="#FF0000">" mlr = %08x\n"</FONT>, mdm.mlr[i]);
|
|
printf(<FONT COLOR="#FF0000">" refcount = %d\n"</FONT>, mdm.refcount);
|
|
printf(<FONT COLOR="#FF0000">" online = %d\n"</FONT>, mdm.online[i]);
|
|
printf(<FONT COLOR="#FF0000">" dialing = %d\n"</FONT>, mdm.dialing[i]);
|
|
printf(<FONT COLOR="#FF0000">" rcvsched = %d\n"</FONT>, mdm.rcvsched[i]);
|
|
printf(<FONT COLOR="#FF0000">" ncarrier = %d\n"</FONT>, mdm.ncarrier[i]);
|
|
printf(<FONT COLOR="#FF0000">" atmodem:\n"</FONT>);
|
|
atm = &mdm.atmodem[i];
|
|
printf(<FONT COLOR="#FF0000">" profile = \n %s\n"</FONT>, <A HREF="#dumpCharArray">dumpCharArray</A>(atm->mdmreg, <A HREF="../includes/isdn.h.shtml#ISDN_MODEM_ANZREG">ISDN_MODEM_ANZREG</A>));
|
|
printf(<FONT COLOR="#FF0000">" mdmreg = \n %s\n"</FONT>, <A HREF="#dumpCharArray">dumpCharArray</A>(atm->mdmreg, <A HREF="../includes/isdn.h.shtml#ISDN_MODEM_ANZREG">ISDN_MODEM_ANZREG</A>));
|
|
printf(<FONT COLOR="#FF0000">" msn = \"%s\"\n"</FONT>, atm->msn);
|
|
printf(<FONT COLOR="#FF0000">" mdmcmdl = %d\n"</FONT>, atm->mdmcmdl);
|
|
printf(<FONT COLOR="#FF0000">" pluscount = %d\n"</FONT>, atm->pluscount);
|
|
printf(<FONT COLOR="#FF0000">" lastplus = %08x\n"</FONT>, atm->lastplus);
|
|
printf(<FONT COLOR="#FF0000">" mdmcmd = \"%s\"\n"</FONT>, atm->mdmcmd);
|
|
printf(<FONT COLOR="#FF0000">" info:\n"</FONT>);
|
|
info = &mdm.info[i];
|
|
printf(<FONT COLOR="#FF0000">" magic = %08x\n"</FONT>, info->magic);
|
|
printf(<FONT COLOR="#FF0000">" flags = %08x\n"</FONT>, info->flags);
|
|
printf(<FONT COLOR="#FF0000">" type = %d\n"</FONT>, info->type);
|
|
printf(<FONT COLOR="#FF0000">" x_char = %02x\n"</FONT>, info->x_char);
|
|
printf(<FONT COLOR="#FF0000">" close_delay = %d\n"</FONT>, info->close_delay);
|
|
printf(<FONT COLOR="#FF0000">" MCR = %08x\n"</FONT>, info->MCR);
|
|
printf(<FONT COLOR="#FF0000">" line = %d\n"</FONT>, info->line);
|
|
printf(<FONT COLOR="#FF0000">" count = %d\n"</FONT>, info->count);
|
|
printf(<FONT COLOR="#FF0000">" blocked_open = %d\n"</FONT>, info->blocked_open);
|
|
printf(<FONT COLOR="#FF0000">" session = %08lx\n"</FONT>, info->session);
|
|
printf(<FONT COLOR="#FF0000">" pgrp = %08lx\n"</FONT>, info->pgrp);
|
|
printf(<FONT COLOR="#FF0000">" isdn_driver = %d\n"</FONT>, info->isdn_driver);
|
|
printf(<FONT COLOR="#FF0000">" isdn_channel = %d\n"</FONT>, info->isdn_channel);
|
|
printf(<FONT COLOR="#FF0000">" drv_index = %d\n"</FONT>, info->drv_index);
|
|
printf(<FONT COLOR="#FF0000">" xmit_size = %d\n"</FONT>, info->xmit_size);
|
|
printf(<FONT COLOR="#FF0000">" xmit_count = %d\n"</FONT>, info->xmit_count);
|
|
}
|
|
}
|
|
|
|
<FONT COLOR="#298C52">void</FONT>
|
|
<A NAME="dumpNetPhone">dumpNetPhone</A>(ulong paddr)
|
|
{
|
|
ulong pa = paddr;
|
|
<A HREF="../includes/isdn.h.shtml#isdn_net_phone">isdn_net_phone</A> *<A HREF="isdn_common.c.shtml#phone">phone</A>;
|
|
|
|
<FONT COLOR="#298C52">while</FONT> (pa) {
|
|
<A HREF="isdn_common.c.shtml#phone">phone</A> = (<A HREF="../includes/isdn.h.shtml#isdn_net_phone">isdn_net_phone</A> *) <A HREF="#mapmem">mapmem</A>(pa, <FONT COLOR="#298C52">sizeof</FONT>(<A HREF="../includes/isdn.h.shtml#isdn_net_phone">isdn_net_phone</A>));
|
|
printf(<FONT COLOR="#FF0000">" @%08lx: \"%s\"\n"</FONT>, pa, <A HREF="isdn_common.c.shtml#phone">phone</A>->num);
|
|
pa = (ulong) (<A HREF="isdn_common.c.shtml#phone">phone</A>->next);
|
|
}
|
|
}
|
|
|
|
<FONT COLOR="#298C52">void</FONT>
|
|
<A NAME="dumpNetDev">dumpNetDev</A>(ulong devaddr)
|
|
{
|
|
ulong nda = devaddr;
|
|
<A HREF="../includes/isdn.h.shtml#isdn_net_dev">isdn_net_dev</A> *ndev;
|
|
|
|
<FONT COLOR="#298C52">while</FONT> (nda) {
|
|
ndev = (<A HREF="../includes/isdn.h.shtml#isdn_net_dev">isdn_net_dev</A> *) <A HREF="#mapmem">mapmem</A>(nda, <FONT COLOR="#298C52">sizeof</FONT>(<A HREF="../includes/isdn.h.shtml#isdn_net_dev">isdn_net_dev</A>));
|
|
printf(<FONT COLOR="#FF0000">"Net-Device @%08lx:\n"</FONT>, nda);
|
|
printf(<FONT COLOR="#FF0000">"dev. :\n"</FONT>);
|
|
printf(<FONT COLOR="#FF0000">" start = %d\n"</FONT>, ndev->dev.start);
|
|
printf(<FONT COLOR="#FF0000">" tbusy = %ld\n"</FONT>, ndev->dev.tbusy);
|
|
printf(<FONT COLOR="#FF0000">" interrupt = %d\n"</FONT>, ndev->dev.interrupt);
|
|
printf(<FONT COLOR="#FF0000">"local. :\n"</FONT>);
|
|
printf(<FONT COLOR="#FF0000">" name = \"%s\"\n"</FONT>, ndev->local.<A HREF="isdn_common.c.shtml#name">name</A>);
|
|
printf(<FONT COLOR="#FF0000">" isdn_device = %d\n"</FONT>, ndev->local.isdn_device);
|
|
printf(<FONT COLOR="#FF0000">" isdn_channel = %d\n"</FONT>, ndev->local.isdn_channel);
|
|
printf(<FONT COLOR="#FF0000">" ppp_minor = %d\n"</FONT>, ndev->local.ppp_minor);
|
|
printf(<FONT COLOR="#FF0000">" pre_device = %d\n"</FONT>, ndev->local.pre_device);
|
|
printf(<FONT COLOR="#FF0000">" pre_channel = %d\n"</FONT>, ndev->local.pre_channel);
|
|
printf(<FONT COLOR="#FF0000">" exclusive = %d\n"</FONT>, ndev->local.exclusive);
|
|
printf(<FONT COLOR="#FF0000">" flags = %d\n"</FONT>, ndev->local.flags);
|
|
printf(<FONT COLOR="#FF0000">" dialstate = %d\n"</FONT>, ndev->local.dialstate);
|
|
printf(<FONT COLOR="#FF0000">" dialretry = %d\n"</FONT>, ndev->local.dialretry);
|
|
printf(<FONT COLOR="#FF0000">" dialmax = %d\n"</FONT>, ndev->local.dialmax);
|
|
printf(<FONT COLOR="#FF0000">" msn = \"%s\"\n"</FONT>, ndev->local.msn);
|
|
printf(<FONT COLOR="#FF0000">" dtimer = %d\n"</FONT>, ndev->local.dtimer);
|
|
printf(<FONT COLOR="#FF0000">" p_encap = %d\n"</FONT>, ndev->local.p_encap);
|
|
printf(<FONT COLOR="#FF0000">" l2_proto = %d\n"</FONT>, ndev->local.l2_proto);
|
|
printf(<FONT COLOR="#FF0000">" l3_proto = %d\n"</FONT>, ndev->local.l3_proto);
|
|
printf(<FONT COLOR="#FF0000">" huptimer = %d\n"</FONT>, ndev->local.huptimer);
|
|
printf(<FONT COLOR="#FF0000">" charge = %d\n"</FONT>, ndev->local.charge);
|
|
printf(<FONT COLOR="#FF0000">" chargetime = %08x\n"</FONT>, ndev->local.chargetime);
|
|
printf(<FONT COLOR="#FF0000">" hupflags = %d\n"</FONT>, ndev->local.hupflags);
|
|
printf(<FONT COLOR="#FF0000">" outgoing = %d\n"</FONT>, ndev->local.outgoing);
|
|
printf(<FONT COLOR="#FF0000">" onhtime = %d\n"</FONT>, ndev->local.onhtime);
|
|
printf(<FONT COLOR="#FF0000">" chargeint = %d\n"</FONT>, ndev->local.chargeint);
|
|
printf(<FONT COLOR="#FF0000">" onum = %d\n"</FONT>, ndev->local.onum);
|
|
printf(<FONT COLOR="#FF0000">" sqfull = %08x\n"</FONT>, ndev->local.sqfull);
|
|
printf(<FONT COLOR="#FF0000">" sqfull_stamp = %08lx\n"</FONT>, ndev->local.sqfull_stamp);
|
|
printf(<FONT COLOR="#FF0000">" master = -> %08x\n"</FONT>, (<FONT COLOR="#298C52">unsigned</FONT> <FONT COLOR="#298C52">int</FONT>) ndev->local.master);
|
|
printf(<FONT COLOR="#FF0000">" slave = -> %08x\n"</FONT>, (<FONT COLOR="#298C52">unsigned</FONT> <FONT COLOR="#298C52">int</FONT>) ndev->local.slave);
|
|
<FONT COLOR="#298C52">if</FONT> (ndev->local.<A HREF="isdn_common.c.shtml#phone">phone</A>[0]) {
|
|
printf(<FONT COLOR="#FF0000">" phone[in]:\n"</FONT>);
|
|
<A HREF="#dumpNetPhone">dumpNetPhone</A>((ulong) ndev->local.<A HREF="isdn_common.c.shtml#phone">phone</A>[0]);
|
|
} <FONT COLOR="#298C52">else</FONT>
|
|
printf(<FONT COLOR="#FF0000">" phone[in] = NULL\n"</FONT>);
|
|
<FONT COLOR="#298C52">if</FONT> (ndev->local.<A HREF="isdn_common.c.shtml#phone">phone</A>[1]) {
|
|
printf(<FONT COLOR="#FF0000">" phone[out]:\n"</FONT>);
|
|
<A HREF="#dumpNetPhone">dumpNetPhone</A>((ulong) ndev->local.<A HREF="isdn_common.c.shtml#phone">phone</A>[1]);
|
|
} <FONT COLOR="#298C52">else</FONT>
|
|
printf(<FONT COLOR="#FF0000">" phone[out] = NULL\n"</FONT>);
|
|
printf(<FONT COLOR="#FF0000">" dial = @%08lx\n"</FONT>, (ulong) ndev->local.dial);
|
|
nda = (ulong) (ndev->next);
|
|
}
|
|
}
|
|
|
|
<FONT COLOR="#298C52">void</FONT>
|
|
main(<FONT COLOR="#298C52">int</FONT> argc, <FONT COLOR="#298C52">char</FONT> *argv[], <FONT COLOR="#298C52">char</FONT> *envp[])
|
|
{
|
|
<FONT COLOR="#298C52">int</FONT> f;
|
|
<FONT COLOR="#298C52">int</FONT> i;
|
|
<FONT COLOR="#298C52">static</FONT> <A HREF="../includes/isdn.h.shtml#isdn_dev">isdn_dev</A> *my_isdndev;
|
|
ulong kaddr;
|
|
|
|
printf(<FONT COLOR="#FF0000">"\nDebugger for isdn and icn Modules\n"</FONT>);
|
|
f = open(<FONT COLOR="#FF0000">"/dev/isdnctrl"</FONT>, O_RDONLY);
|
|
<FONT COLOR="#298C52">if</FONT> (ioctl(f, <A HREF="../includes/isdn.h.shtml#IIOCDBGVAR">IIOCDBGVAR</A>, &kaddr)) {
|
|
perror(<FONT COLOR="#FF0000">"ioctl IIOCDBGVAR"</FONT>);
|
|
exit(-1);
|
|
}
|
|
close(f);
|
|
<FONT COLOR="#298C52">if</FONT> ((mem_fd = open(<FONT COLOR="#FF0000">"/dev/kmem"</FONT>, O_RDWR)) < 0) {
|
|
perror(<FONT COLOR="#FF0000">"open /dev/kmem"</FONT>);
|
|
exit(1);
|
|
}
|
|
printf(<FONT COLOR="#FF0000">"isdn-main-struct at %08lx (%d):\n"</FONT>, kaddr, <FONT COLOR="#298C52">sizeof</FONT>(<A HREF="../includes/isdn.h.shtml#isdn_dev">isdn_dev</A>));
|
|
my_isdndev = (<A HREF="../includes/isdn.h.shtml#isdn_dev">isdn_dev</A> *) <A HREF="#mapmem">mapmem</A>(kaddr, <FONT COLOR="#298C52">sizeof</FONT>(<A HREF="../includes/isdn.h.shtml#isdn_dev">isdn_dev</A>));
|
|
printf(<FONT COLOR="#FF0000">"isdndev.flags = %d\n"</FONT>, my_isdndev->flags);
|
|
printf(<FONT COLOR="#FF0000">"isdndev.drivers = %d\n"</FONT>, my_isdndev->drivers);
|
|
printf(<FONT COLOR="#FF0000">"isdndev.channels = %d\n"</FONT>, my_isdndev->channels);
|
|
printf(<FONT COLOR="#FF0000">"isdndev.net_verbose = %d\n"</FONT>, my_isdndev->net_verbose);
|
|
printf(<FONT COLOR="#FF0000">"isdndev.modempoll = %d\n"</FONT>, my_isdndev->modempoll);
|
|
printf(<FONT COLOR="#FF0000">"isdndev.tflags = %d\n"</FONT>, my_isdndev->tflags);
|
|
printf(<FONT COLOR="#FF0000">"isdndev.global_flags = %d\n"</FONT>, my_isdndev->global_flags);
|
|
<FONT COLOR="#298C52">if</FONT> (my_isdndev->infochain) {
|
|
printf(<FONT COLOR="#FF0000">"isdndev.infochain = @%08lx:\n"</FONT>, (ulong) my_isdndev->infochain);
|
|
} <FONT COLOR="#298C52">else</FONT>
|
|
printf(<FONT COLOR="#FF0000">"isdndev.infochain = NULL\n"</FONT>);
|
|
<FONT COLOR="#298C52">if</FONT> (my_isdndev->info_waitq) {
|
|
printf(<FONT COLOR="#FF0000">"isdndev.info_waitq = @%08lx:\n"</FONT>, (ulong) my_isdndev->info_waitq);
|
|
} <FONT COLOR="#298C52">else</FONT>
|
|
printf(<FONT COLOR="#FF0000">"isdndev.info_waitq = NULL\n"</FONT>);
|
|
printf(<FONT COLOR="#FF0000">"isdndev.chanmap = %s\n"</FONT>,
|
|
<A HREF="#dumpIntArray">dumpIntArray</A>(my_isdndev->chanmap, <A HREF="../includes/isdn.h.shtml#ISDN_MAX_CHANNELS">ISDN_MAX_CHANNELS</A>));
|
|
printf(<FONT COLOR="#FF0000">"isdndev.drvmap = %s\n"</FONT>,
|
|
<A HREF="#dumpIntArray">dumpIntArray</A>(my_isdndev->drvmap, <A HREF="../includes/isdn.h.shtml#ISDN_MAX_CHANNELS">ISDN_MAX_CHANNELS</A>));
|
|
printf(<FONT COLOR="#FF0000">"isdndev.usage = %s\n"</FONT>,
|
|
<A HREF="#dumpIntArray">dumpIntArray</A>(my_isdndev->usage, <A HREF="../includes/isdn.h.shtml#ISDN_MAX_CHANNELS">ISDN_MAX_CHANNELS</A>));
|
|
printf(<FONT COLOR="#FF0000">"isdndev.num = %s\n"</FONT>,
|
|
<A HREF="#dumpStringArray">dumpStringArray</A>(my_isdndev->num[0], <A HREF="../includes/isdn.h.shtml#ISDN_MAX_CHANNELS">ISDN_MAX_CHANNELS</A>, 20));
|
|
printf(<FONT COLOR="#FF0000">"isdndev.m_idx = %s\n"</FONT>,
|
|
<A HREF="#dumpIntArray">dumpIntArray</A>(my_isdndev->m_idx, <A HREF="../includes/isdn.h.shtml#ISDN_MAX_CHANNELS">ISDN_MAX_CHANNELS</A>));
|
|
<A HREF="#dumpModem">dumpModem</A>(my_isdndev->mdm);
|
|
<FONT COLOR="#298C52">for</FONT> (i = 0; i < <A HREF="../includes/isdn.h.shtml#ISDN_MAX_DRIVERS">ISDN_MAX_DRIVERS</A>; i++)
|
|
<FONT COLOR="#298C52">if</FONT> (my_isdndev->drv[i]) {
|
|
printf(<FONT COLOR="#FF0000">"isdndev.drv[%02d] = @%08lx:\n"</FONT>, i, (ulong) my_isdndev->drv[i]);
|
|
<A HREF="#dumpDriver">dumpDriver</A>((ulong) (my_isdndev->drv[i]));
|
|
}
|
|
<FONT COLOR="#298C52">if</FONT> (my_isdndev->netdev) {
|
|
printf(<FONT COLOR="#FF0000">"isdndev.netdev = @%08lx:\n"</FONT>, (ulong) my_isdndev->netdev);
|
|
<A HREF="#dumpNetDev">dumpNetDev</A>((ulong) my_isdndev->netdev);
|
|
} <FONT COLOR="#298C52">else</FONT>
|
|
printf(<FONT COLOR="#FF0000">"isdndev.netdev = NULL\n"</FONT>);
|
|
close(mem_fd);
|
|
}
|
|
</BODY>
|
|
|
|
</HTML>
|