[zaptel-commits] kpfleming: branch 1.4 r3278 - in /branches/1.4: ./ wct4xxp/ wctdm24xxp/

SVN commits to the Zaptel project zaptel-commits at lists.digium.com
Tue Dec 4 07:55:20 CST 2007


Author: kpfleming
Date: Tue Dec  4 07:55:19 2007
New Revision: 3278

URL: http://svn.digium.com/view/zaptel?view=rev&rev=3278
Log:
add a new Zaptel scanning tool, primarily for use by the Asterisk GUI, called 'ztscan'. this tool outputs an Asterisk-style
configuration file containing one context for each Zaptel span with all the details that can be learned about that span. to
enable this tool, the ZT_SPANSTAT ioctl gained a number of new elements to report information about the spans:
  - linecompat (available signaling modes for digital spans)
  - spantype (T1, E1 or J1 for digital spans)
  - location (PCI/PCI-Express location)
  - manufacturer
  - devicetype

Along the way I also found that the digital span drivers always set T1-style signaling bits in 'linecompat' even for E1 spans,
and that the ZT_SPANCONFIG ioctl did not properly check these bits when configuring E1 spans. The result of this is that it was
possible to configure T1-only coding/framing (AMI/B8Zs, D4/ESF) on E1 spans (but not the reverse); this has been corrected and
any attempt to use T1-only coding/framing on E1 spans will now result in an error from ztcfg.

Also did some minor simplification of the Makefile rules that build the userspace tools.

(the basics of ztscan were written by Brandon Kruse then reworked and fleshed out by me)


Added:
    branches/1.4/ztscan.c
      - copied unchanged from r3277, team/kpfleming/ztscan/ztscan.c
Modified:
    branches/1.4/   (props changed)
    branches/1.4/Makefile
    branches/1.4/tor2.c
    branches/1.4/torisa.c
    branches/1.4/wcfxo.c
    branches/1.4/wct1xxp.c
    branches/1.4/wct4xxp/base.c
    branches/1.4/wctdm.c
    branches/1.4/wctdm24xxp/base.c
    branches/1.4/wctdm24xxp/wctdm24xxp.h
    branches/1.4/wcte11xp.c
    branches/1.4/wcte12xp.c
    branches/1.4/wcusb.c
    branches/1.4/wcusb.h
    branches/1.4/zaptel-base.c
    branches/1.4/zaptel.h
    branches/1.4/ztdummy.c

Propchange: branches/1.4/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Tue Dec  4 07:55:19 2007
@@ -46,3 +46,4 @@
 Modules.symvers
 Module.symvers
 README.html
+ztscan

Modified: branches/1.4/Makefile
URL: http://svn.digium.com/view/zaptel/branches/1.4/Makefile?view=diff&rev=3278&r1=3277&r2=3278
==============================================================================
--- branches/1.4/Makefile (original)
+++ branches/1.4/Makefile Tue Dec  4 07:55:19 2007
@@ -235,7 +235,8 @@
 
 # Utilities we build with a standard build procedure:
 UTILS		= zttool zttest ztmonitor ztspeed sethdlc-new ztcfg \
-		  ztcfg-dude usbfxstest fxstest fxotune ztdiag torisatool
+		  ztcfg-dude usbfxstest fxstest fxotune ztdiag torisatool \
+		  ztscan
 
 
 # Makefile mentions them. Source is not included (anynore?)
@@ -247,7 +248,7 @@
 
 UTILSO		= $(UTILS:%=%.o)
 
-BINS:=fxotune fxstest sethdlc-new ztcfg ztdiag ztmonitor ztspeed zttest zttool
+BINS:=fxotune fxstest sethdlc-new ztcfg ztdiag ztmonitor ztspeed zttest zttool ztscan
 BINS:=$(filter-out $(MENUSELECT_UTILS),$(BINS))
 MAN_PAGES:=$(wildcard $(BINS:%=doc/%.8))
 
@@ -320,17 +321,19 @@
 
 prereq: config.status tones.h tor2fw.h radfw.h version.h
 
-zttool.o: zttool.c zaptel.h
-zttool.o: CFLAGS+=$(NEWT_INCLUDE)
-
-ztprovision.o: ztprovision.c zaptel.h
-
-ztmonitor.o: ztmonitor.c zaptel.h
+zttool: zaptel.h
+zttool: CFLAGS+=$(NEWT_INCLUDE)
+zttool: LDLIBS+=$(NEWT_LIB)
+
+ztscan: zaptel.h
+
+ztprovision: zaptel.h
+
+ztmonitor: zaptel.h
 
 ztspeed: CFLAGS=
-ztspeed.o: CFLAGS=
-zttool: LDLIBS+=$(NEWT_LIB)
-sethdlc-new.o: CFLAGS+=-I$(KINCLUDES)
+
+sethdlc-new: CFLAGS+=-I$(KINCLUDES)
 
 $(LTZ_A): $(LTZ_A_OBJS)
 	ar rcs $@ $^
@@ -339,19 +342,18 @@
 $(LTZ_SO): $(LTZ_SO_OBJS)
 	$(CC) $(CFLAGS) -shared -Wl,-soname,$(LTZ_SO).$(LTZ_SO_MAJOR_VER).$(LTZ_SO_MINOR_VER) -o $@ $^ $(LDFLAGS) $(LDLIBS) -lm
 
-ztcfg.c: ztcfg.h
+ztcfg.o: ztcfg.h zaptel.h
+ztcfg: ztcfg.o $(LTZ_A)
+ztcfg: LDLIBS+=-lm
 
 ztcfg-shared: ztcfg.o $(LTZ_SO)
 	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LDLIBS) -lm
 
+ztcfg-dude: ztcfg-dude.o mknotch.o complex.o $(LTZ_SO)
+ztcfg-dude: LDLIBS+=-lm -lstdc++
+
 data:
 	$(MAKE) -C datamods datamods
-
-ztcfg: ztcfg.o $(LTZ_A)
-ztcfg: LDLIBS+=-lm
-
-ztcfg-dude: ztcfg-dude.o mknotch.o complex.o $(LTZ_SO)
-ztcfg-dude: LDLIBS+=-lm -lstdc++
 
 # FIXME: we assume CC can build the C++ modules:
 complex.o mknotch.o: %.o: %.cc

Modified: branches/1.4/tor2.c
URL: http://svn.digium.com/view/zaptel/branches/1.4/tor2.c?view=diff&rev=3278&r1=3277&r2=3278
==============================================================================
--- branches/1.4/tor2.c (original)
+++ branches/1.4/tor2.c Tue Dec  4 07:55:19 2007
@@ -269,15 +269,11 @@
 {
 	int x, y, c;
 	for (x = 0; x < SPANS_PER_CARD; x++) {
-		sprintf(tor->spans[x].name,
-                	"Tor2/%d/%d", 
-		        tor->num,
-                        x + 1);
-		sprintf(tor->spans[x].desc,
-                	"Tormenta 2 (PCI) Quad %s Card %d Span %d",
-                        (tor->cardtype == TYPE_T1)  ?  "T1"  :  "E1",
-                	tor->num,
-                        x + 1);
+		sprintf(tor->spans[x].name, "Tor2/%d/%d", tor->num, x + 1);
+		sprintf(tor->spans[x].desc, "Tormenta 2 (PCI) Quad %s Card %d Span %d", (tor->cardtype == TYPE_T1)  ?  "T1"  :  "E1", tor->num, x + 1);
+		tor->spans[x].manufacturer = "Digium";
+		tor->spans[x].devicetype = tor->type;
+		sprintf(tor->spans[x].location, "PCI Bus %02d Slot %02d", tor->pci->bus->number, PCI_SLOT(tor->pci->devfn) + 1);
 		tor->spans[x].spanconfig = tor2_spanconfig;
 		tor->spans[x].chanconfig = tor2_chanconfig;
 		tor->spans[x].startup = tor2_startup;
@@ -289,13 +285,16 @@
 		if (tor->cardtype == TYPE_T1) {
 			tor->spans[x].channels = 24;
 			tor->spans[x].deflaw = ZT_LAW_MULAW;
+			tor->spans[x].linecompat = ZT_CONFIG_AMI | ZT_CONFIG_B8ZS | ZT_CONFIG_D4 | ZT_CONFIG_ESF;
+			tor->spans[x].spantype = "T1";
 		} else {
 			tor->spans[x].channels = 31;
 			tor->spans[x].deflaw = ZT_LAW_ALAW;
+			tor->spans[x].linecompat = ZT_CONFIG_HDB3 | ZT_CONFIG_CCS | ZT_CONFIG_CRC4;
+			tor->spans[x].spantype = "E1";
 		}
 		tor->spans[x].chans = tor->chans[x];
 		tor->spans[x].flags = ZT_FLAG_RBS;
-		tor->spans[x].linecompat = ZT_CONFIG_AMI | ZT_CONFIG_B8ZS | ZT_CONFIG_D4 | ZT_CONFIG_ESF;
 		tor->spans[x].ioctl = tor2_ioctl;
 		tor->spans[x].pvt = &tor->tspans[x];
 		tor->tspans[x].tor = tor;
@@ -1518,6 +1517,3 @@
 
 module_init(tor2_init);
 module_exit(tor2_cleanup);
-
-
-

Modified: branches/1.4/torisa.c
URL: http://svn.digium.com/view/zaptel/branches/1.4/torisa.c?view=diff&rev=3278&r1=3277&r2=3278
==============================================================================
--- branches/1.4/torisa.c (original)
+++ branches/1.4/torisa.c Tue Dec  4 07:55:19 2007
@@ -1077,8 +1077,11 @@
 		free_irq(irq, NULL);
 		return -EIO;
 	}
+
 	strcpy(spans[0].name, "TorISA/1");
 	strcpy(spans[0].desc, "ISA Tormenta Span 1");
+	spans[0].manufacturer = "Digium";
+	spans[0].devicetype = "Tormenta ISA";
 	spans[0].spanconfig = torisa_spanconfig;
 	spans[0].chanconfig = torisa_chanconfig;
 	spans[0].startup = torisa_startup;
@@ -1090,35 +1093,25 @@
 	spans[0].channels = channels_per_span;
 	spans[0].chans = &chans[0];
 	spans[0].flags = ZT_FLAG_RBS;
-	spans[0].linecompat = ZT_CONFIG_AMI | ZT_CONFIG_B8ZS | ZT_CONFIG_D4 | ZT_CONFIG_ESF;
 	spans[0].ioctl = torisa_ioctl;
 	spans[0].irq = irq;
-	init_waitqueue_head(&spans[0].maintq);
-
-
+
+	if (card_type == TYPE_E1) {
+		spans[0].spantype = "T1";
+		spans[0].linecompat = ZT_CONFIG_AMI | ZT_CONFIG_B8ZS | ZT_CONFIG_D4 | ZT_CONFIG_ESF;
+		spans[0].deflaw = ZT_LAW_ALAW;
+	} else {
+		spans[0].spantype = "E1";
+		spans[0].linecompat = ZT_CONFIG_HDB3 | ZT_CONFIG_CCS | ZT_CONFIG_CRC4;
+		spans[0].deflaw = ZT_LAW_MULAW;
+	}
+
+	spans[1] = spans[0];
 	strcpy(spans[1].name, "TorISA/2");
 	strcpy(spans[1].desc, "ISA Tormenta Span 2");
-	spans[1].spanconfig = torisa_spanconfig;
-	spans[1].chanconfig = torisa_chanconfig;
-	spans[1].startup = torisa_startup;
-	spans[1].shutdown = torisa_shutdown;
-	spans[1].rbsbits = torisa_rbsbits;
-	spans[1].maint = torisa_maint;
-	spans[1].open = torisa_open;
-	spans[1].close = torisa_close;
-	spans[1].channels = channels_per_span;
 	spans[1].chans = &chans[channels_per_span];
-	spans[1].flags = ZT_FLAG_RBS;
-	spans[1].linecompat = ZT_CONFIG_AMI | ZT_CONFIG_B8ZS | ZT_CONFIG_D4 | ZT_CONFIG_ESF;
-	spans[1].ioctl = torisa_ioctl;
-	spans[1].irq = irq;
-	if (card_type == TYPE_E1) {
-		spans[0].deflaw = ZT_LAW_ALAW;
-		spans[1].deflaw = ZT_LAW_ALAW;
-	} else {
-		spans[0].deflaw = ZT_LAW_MULAW;
-		spans[1].deflaw = ZT_LAW_MULAW;
-	}
+
+	init_waitqueue_head(&spans[0].maintq);
 	init_waitqueue_head(&spans[1].maintq);
 
 	make_chans();

Modified: branches/1.4/wcfxo.c
URL: http://svn.digium.com/view/zaptel/branches/1.4/wcfxo.c?view=diff&rev=3278&r1=3277&r2=3278
==============================================================================
--- branches/1.4/wcfxo.c (original)
+++ branches/1.4/wcfxo.c Tue Dec  4 07:55:19 2007
@@ -627,6 +627,9 @@
 	sprintf(wc->span.name, "WCFXO/%d", wc->pos);
 	sprintf(wc->span.desc, "%s Board %d", wc->variety, wc->pos + 1);
 	sprintf(wc->chan.name, "WCFXO/%d/%d", wc->pos, 0);
+	sprintf(wc->span.location, "PCI Bus %02d Slot %02d", wc->dev->bus->number, PCI_SLOT(wc->dev->devfn) + 1);
+	wc->span.manufacturer = "Digium";
+	wc->span.devicetype = wc->variety;
 	wc->chan.sigcap = ZT_SIG_FXSKS | ZT_SIG_FXSLS | ZT_SIG_SF;
 	wc->chan.chanpos = 1;
 	wc->span.chans = &wc->chan;

Modified: branches/1.4/wct1xxp.c
URL: http://svn.digium.com/view/zaptel/branches/1.4/wct1xxp.c?view=diff&rev=3278&r1=3277&r2=3278
==============================================================================
--- branches/1.4/wct1xxp.c (original)
+++ branches/1.4/wct1xxp.c Tue Dec  4 07:55:19 2007
@@ -747,7 +747,6 @@
 		return t1xxp_startup(span);
 	return 0;
 }
-
 static int t1xxp_software_init(struct t1xxp *wc)
 {
 	int x;
@@ -763,6 +762,9 @@
 	wc->num = x;
 	sprintf(wc->span.name, "WCT1/%d", wc->num);
 	sprintf(wc->span.desc, "%s Card %d", wc->variety, wc->num);
+	wc->span.manufacturer = "Digium";
+	wc->span.devicetype = wc->variety;
+	sprintf(wc->span.location, "PCI Bus %02d Slot %02d", wc->dev->bus->number, PCI_SLOT(wc->dev->devfn) + 1);
 	wc->span.spanconfig = t1xxp_spanconfig;
 	wc->span.chanconfig = t1xxp_chanconfig;
 	wc->span.irq = wc->dev->irq;
@@ -778,13 +780,17 @@
 		wc->span.channels = 24;
 	wc->span.chans = wc->chans;
 	wc->span.flags = ZT_FLAG_RBS;
-	wc->span.linecompat = ZT_CONFIG_AMI | ZT_CONFIG_B8ZS | ZT_CONFIG_D4 | ZT_CONFIG_ESF;
 	wc->span.ioctl = t1xxp_ioctl;
 	wc->span.pvt = wc;
-	if (wc->ise1)
+	if (wc->ise1) {
 		wc->span.deflaw = ZT_LAW_ALAW;
-	else
+		wc->span.linecompat = ZT_CONFIG_AMI | ZT_CONFIG_B8ZS | ZT_CONFIG_D4 | ZT_CONFIG_ESF;
+		wc->span.spantype = "T1";
+	} else {
 		wc->span.deflaw = ZT_LAW_MULAW;
+		wc->span.linecompat = ZT_CONFIG_HDB3 | ZT_CONFIG_CCS | ZT_CONFIG_CRC4;
+		wc->span.spantype = "E1";
+	}
 	init_waitqueue_head(&wc->span.maintq);
 	for (x=0;x<wc->span.channels;x++) {
 		sprintf(wc->chans[x].name, "WCT1/%d/%d", wc->num, x + 1);

Modified: branches/1.4/wct4xxp/base.c
URL: http://svn.digium.com/view/zaptel/branches/1.4/wct4xxp/base.c?view=diff&rev=3278&r1=3277&r2=3278
==============================================================================
--- branches/1.4/wct4xxp/base.c (original)
+++ branches/1.4/wct4xxp/base.c Tue Dec  4 07:55:19 2007
@@ -210,7 +210,8 @@
 #define FLAG_VPM2GEN (1 << 5)
 #define FLAG_OCTOPT  (1 << 6)
 #define FLAG_3RDGEN  (1 << 7)
-#define FLAG_BURST  (1 << 8)
+#define FLAG_BURST   (1 << 8)
+#define FLAG_EXPRESS (1 << 9)
 
 #define CANARY 0xc0de
 
@@ -220,14 +221,14 @@
 };
 
 static struct devtype wct4xxp = { "Wildcard TE410P/TE405P (1st Gen)", 0 };
-static struct devtype wct420p4 = { "Wildcard TE420 (4th Gen)", FLAG_BURST | FLAG_2NDGEN | FLAG_3RDGEN };
+static struct devtype wct420p4 = { "Wildcard TE420 (4th Gen)", FLAG_BURST | FLAG_2NDGEN | FLAG_3RDGEN | FLAG_EXPRESS };
 static struct devtype wct410p4 = { "Wildcard TE410P (4th Gen)", FLAG_BURST | FLAG_2NDGEN | FLAG_3RDGEN };
 static struct devtype wct410p3 = { "Wildcard TE410P (3rd Gen)", FLAG_2NDGEN | FLAG_3RDGEN };
 static struct devtype wct405p4 = { "Wildcard TE405P (4th Gen)", FLAG_BURST | FLAG_2NDGEN | FLAG_3RDGEN };
 static struct devtype wct405p3 = { "Wildcard TE405P (3rd Gen)", FLAG_2NDGEN | FLAG_3RDGEN };
 static struct devtype wct410p2 = { "Wildcard TE410P (2nd Gen)", FLAG_2NDGEN };
 static struct devtype wct405p2 = { "Wildcard TE405P (2nd Gen)", FLAG_2NDGEN };
-static struct devtype wct220p4 = { "Wildcard TE220 (4th Gen)", FLAG_BURST | FLAG_2NDGEN | FLAG_3RDGEN | FLAG_2PORT };
+static struct devtype wct220p4 = { "Wildcard TE220 (4th Gen)", FLAG_BURST | FLAG_2NDGEN | FLAG_3RDGEN | FLAG_2PORT | FLAG_EXPRESS };
 static struct devtype wct205p4 = { "Wildcard TE205P (4th Gen)", FLAG_BURST | FLAG_2NDGEN | FLAG_3RDGEN | FLAG_2PORT };
 static struct devtype wct205p3 = { "Wildcard TE205P (3rd Gen)", FLAG_2NDGEN | FLAG_3RDGEN | FLAG_2PORT };
 static struct devtype wct210p4 = { "Wildcard TE210P (4th Gen)", FLAG_BURST | FLAG_2NDGEN | FLAG_3RDGEN | FLAG_2PORT };
@@ -1526,11 +1527,24 @@
 	gen2 = (wc->tspans[0]->spanflags & FLAG_2NDGEN);
 	if (!wc->t1e1)
 		offset += 4;
-	for (x=0;x<wc->numspans;x++) {
+	for (x = 0; x < wc->numspans; x++) {
 		ts = wc->tspans[x];
-		sprintf(ts->span.name, "TE%d/%d/%d", wc->numspans,
-		       wc->num, x + 1);
+		sprintf(ts->span.name, "TE%d/%d/%d", wc->numspans, wc->num, x + 1);
 		sprintf(ts->span.desc, "T%dXXP (PCI) Card %d Span %d", wc->numspans, wc->num, x+1);
+		ts->span.manufacturer = "Digium";
+		ts->span.devicetype = wc->variety;
+		sprintf(ts->span.location, "PCI%sBus %02d Slot %02d", ts->spanflags & FLAG_EXPRESS ? " Express" : " ", wc->dev->bus->number, PCI_SLOT(wc->dev->devfn) + 1);
+		switch (ts->spantype) {
+		case TYPE_T1:
+			ts->span.spantype = "T1";
+			break;
+		case TYPE_E1:
+			ts->span.spantype = "E1";
+			break;
+		case TYPE_J1:
+			ts->span.spantype = "J1";
+			break;
+		}
 		ts->span.spanconfig = t4_spanconfig;
 		ts->span.chanconfig = t4_chanconfig;
 		ts->span.irq = wc->dev->irq;
@@ -1549,13 +1563,14 @@
 		if (ts->spantype == TYPE_T1 || ts->spantype == TYPE_J1) {
 			ts->span.channels = 24;
 			ts->span.deflaw = ZT_LAW_MULAW;
+			ts->span.linecompat = ZT_CONFIG_AMI | ZT_CONFIG_B8ZS | ZT_CONFIG_D4 | ZT_CONFIG_ESF;
 		} else {
 			ts->span.channels = 31;
 			ts->span.deflaw = ZT_LAW_ALAW;
+			ts->span.linecompat = ZT_CONFIG_HDB3 | ZT_CONFIG_CCS | ZT_CONFIG_CRC4;
 		}
 		ts->span.chans = ts->chans;
 		ts->span.flags = ZT_FLAG_RBS;
-		ts->span.linecompat = ZT_CONFIG_AMI | ZT_CONFIG_B8ZS | ZT_CONFIG_D4 | ZT_CONFIG_ESF;
 		ts->span.ioctl = t4_ioctl;
 		ts->span.hdlc_hard_xmit = t4_hdlc_hard_xmit;
 		if (gen2) {

Modified: branches/1.4/wctdm.c
URL: http://svn.digium.com/view/zaptel/branches/1.4/wctdm.c?view=diff&rev=3278&r1=3277&r2=3278
==============================================================================
--- branches/1.4/wctdm.c (original)
+++ branches/1.4/wctdm.c Tue Dec  4 07:55:19 2007
@@ -2023,6 +2023,9 @@
 	/* Zapata stuff */
 	sprintf(wc->span.name, "WCTDM/%d", wc->pos);
 	sprintf(wc->span.desc, "%s Board %d", wc->variety, wc->pos + 1);
+	sprintf(wc->span.location, "PCI Bus %02d Slot %02d", wc->dev->bus->number, PCI_SLOT(wc->dev->devfn) + 1);
+	wc->span.manufacturer = "Digium";
+	wc->span.devicetype = wc->variety;
 	if (alawoverride) {
 		printk("ALAW override parameter detected.  Device will be operating in ALAW\n");
 		wc->span.deflaw = ZT_LAW_ALAW;

Modified: branches/1.4/wctdm24xxp/base.c
URL: http://svn.digium.com/view/zaptel/branches/1.4/wctdm24xxp/base.c?view=diff&rev=3278&r1=3277&r2=3278
==============================================================================
--- branches/1.4/wctdm24xxp/base.c (original)
+++ branches/1.4/wctdm24xxp/base.c Tue Dec  4 07:55:19 2007
@@ -253,8 +253,8 @@
 static struct wctdm_desc wctdm2400 = { "Wildcard TDM2400P", 0, 24 };
 static struct wctdm_desc wctdm800 = { "Wildcard TDM800P", 0, 8 };
 static struct wctdm_desc wctdm410 = { "Wildcard TDM410P", 0, 4 };
-static struct wctdm_desc wcaex2400 = { "Wildcard AEX2400", 0, 24 };
-static struct wctdm_desc wcaex800 = { "Wildcard AEX800", 0, 8 };
+static struct wctdm_desc wcaex2400 = { "Wildcard AEX2400", FLAG_EXPRESS, 24 };
+static struct wctdm_desc wcaex800 = { "Wildcard AEX800", FLAG_EXPRESS, 8 };
 
 static int acim2tiss[16] = { 0x0, 0x1, 0x4, 0x5, 0x7, 0x0, 0x0, 0x6, 0x0, 0x0, 0x0, 0x2, 0x0, 0x3 };
 
@@ -3046,6 +3046,9 @@
 	/* Zapata stuff */
 	sprintf(wc->span.name, "WCTDM/%d", wc->pos);
 	sprintf(wc->span.desc, "%s Board %d", wc->variety, wc->pos + 1);
+	sprintf(wc->span.location, "PCI%s Bus %02d Slot %02d", (wc->flags[0] & FLAG_EXPRESS) ? " Express" : "", wc->dev->bus->number, PCI_SLOT(wc->dev->devfn) + 1);
+	wc->span.manufacturer = "Digium";
+	wc->span.devicetype = wc->variety;
 	if (alawoverride) {
 		printk("ALAW override parameter detected.  Device will be operating in ALAW\n");
 		wc->span.deflaw = ZT_LAW_ALAW;

Modified: branches/1.4/wctdm24xxp/wctdm24xxp.h
URL: http://svn.digium.com/view/zaptel/branches/1.4/wctdm24xxp/wctdm24xxp.h?view=diff&rev=3278&r1=3277&r2=3278
==============================================================================
--- branches/1.4/wctdm24xxp/wctdm24xxp.h (original)
+++ branches/1.4/wctdm24xxp/wctdm24xxp.h Tue Dec  4 07:55:19 2007
@@ -22,6 +22,7 @@
 #define OHT_TIMER		6000	/* How long after RING to retain OHT */
 
 #define FLAG_3215	(1 << 0)
+#define FLAG_EXPRESS	(1 << 1)
 
 #define EFRAME_SIZE	108
 #define ERING_SIZE 16		/* Maximum ring size */

Modified: branches/1.4/wcte11xp.c
URL: http://svn.digium.com/view/zaptel/branches/1.4/wcte11xp.c?view=diff&rev=3278&r1=3277&r2=3278
==============================================================================
--- branches/1.4/wcte11xp.c (original)
+++ branches/1.4/wcte11xp.c Tue Dec  4 07:55:19 2007
@@ -972,6 +972,9 @@
 	wc->num = x;
 	sprintf(wc->span.name, "WCT1/%d", wc->num);
 	sprintf(wc->span.desc, "%s Card %d", wc->variety, wc->num);
+	wc->span.manufacturer = "Digium";
+	wc->span.devicetype = wc->variety;
+	sprintf(wc->span.location, "PCI Bus %02d Slot %02d", wc->dev->bus->number, PCI_SLOT(wc->dev->devfn) + 1);
 	wc->span.spanconfig = t1xxp_spanconfig;
 	wc->span.chanconfig = t1xxp_chanconfig;
 	wc->span.irq = wc->dev->irq;
@@ -986,11 +989,15 @@
 			wc->span.channels = 32;
 		else
 			wc->span.channels = 31;
-	} else
+		wc->span.spantype = "E1";
+		wc->span.linecompat = ZT_CONFIG_HDB3 | ZT_CONFIG_CCS | ZT_CONFIG_CRC4;
+	} else {
 		wc->span.channels = 24;
+		wc->span.spantype = "T1";
+		wc->span.linecompat = ZT_CONFIG_AMI | ZT_CONFIG_B8ZS | ZT_CONFIG_D4 | ZT_CONFIG_ESF;
+	}
 	wc->span.chans = wc->chans;
 	wc->span.flags = ZT_FLAG_RBS;
-	wc->span.linecompat = ZT_CONFIG_AMI | ZT_CONFIG_B8ZS | ZT_CONFIG_D4 | ZT_CONFIG_ESF;
 	wc->span.ioctl = t1xxp_ioctl;
 	wc->span.pvt = wc;
 	if (wc->spantype == TYPE_E1)

Modified: branches/1.4/wcte12xp.c
URL: http://svn.digium.com/view/zaptel/branches/1.4/wcte12xp.c?view=diff&rev=3278&r1=3277&r2=3278
==============================================================================
--- branches/1.4/wcte12xp.c (original)
+++ branches/1.4/wcte12xp.c Tue Dec  4 07:55:19 2007
@@ -1353,6 +1353,9 @@
 	wc->num = x;
 	sprintf(wc->span.name, "WCT1/%d", wc->num);
 	sprintf(wc->span.desc, "%s Card %d", wc->variety, wc->num);
+	wc->span.manufacturer = "Digium";
+	wc->span.devicetype = wc->variety;
+	sprintf(wc->span.location, "PCI Bus %02d Slot %02d", wc->dev->bus->number, PCI_SLOT(wc->dev->devfn) + 1);
 
 	wc->span.spanconfig = t1xxp_spanconfig;
 	wc->span.chanconfig = t1xxp_chanconfig;
@@ -1370,8 +1373,13 @@
 			wc->span.channels = 32;
 		else
 			wc->span.channels = 31;
-	} else
+		wc->span.spantype = "E1";
+		wc->span.linecompat = ZT_CONFIG_HDB3 | ZT_CONFIG_CCS | ZT_CONFIG_CRC4;
+	} else {
 		wc->span.channels = 24;
+		wc->span.spantype = "T1";
+		wc->span.linecompat = ZT_CONFIG_AMI | ZT_CONFIG_B8ZS | ZT_CONFIG_D4 | ZT_CONFIG_ESF;
+	}
 	wc->span.chans = wc->chans;
 	wc->span.flags = ZT_FLAG_RBS;
 	wc->span.linecompat = ZT_CONFIG_AMI | ZT_CONFIG_B8ZS | ZT_CONFIG_D4 | ZT_CONFIG_ESF;

Modified: branches/1.4/wcusb.c
URL: http://svn.digium.com/view/zaptel/branches/1.4/wcusb.c?view=diff&rev=3278&r1=3277&r2=3278
==============================================================================
--- branches/1.4/wcusb.c (original)
+++ branches/1.4/wcusb.c Tue Dec  4 07:55:19 2007
@@ -1250,6 +1250,8 @@
 	sprintf(p->span.name, "WCUSB/%d", x);
 	sprintf(p->span.desc,"%s %d", p->span.name, x);
         sprintf(p->chan.name, "WCUSB/%d/%d", x, 0);
+	p->span.manufacturer = "Digium";
+	p->span.devicetype = p->variety;
 
         p->chan.sigcap = ZT_SIG_FXOKS | ZT_SIG_FXOLS | ZT_SIG_FXOGS;    /* We're capabable of both FXOKS and FXOLS */
         p->chan.chanpos = 1;
@@ -1261,11 +1263,11 @@
         p->span.close = wc_usb_close;
 
 	ifaces[x] = p;
-    p->pos = x;
-    p->span.flags = ZT_FLAG_RBS;
-    init_waitqueue_head(&p->span.maintq);
-    p->span.pvt = p;
-    p->chan.pvt = p;
+	p->pos = x;
+	p->span.flags = ZT_FLAG_RBS;
+	init_waitqueue_head(&p->span.maintq);
+	p->span.pvt = p;
+	p->chan.pvt = p;
 	
 	/* Set the stream to just pass the data from the device uninhibited */
 	p->sample = STREAM_NORMAL;
@@ -1357,6 +1359,7 @@
 	p->dead = 0;
 	/* Clear alarms */
 	p->span.alarms = 0;
+	p->variety = d->name;
 	zt_alarm_notify(&p->span);
 #ifdef LINUX26
 	usb_set_intfdata(intf, p);
@@ -1485,4 +1488,3 @@
 
 module_init(wc_init);
 module_exit(wc_cleanup);
-

Modified: branches/1.4/wcusb.h
URL: http://svn.digium.com/view/zaptel/branches/1.4/wcusb.h?view=diff&rev=3278&r1=3277&r2=3278
==============================================================================
--- branches/1.4/wcusb.h (original)
+++ branches/1.4/wcusb.h Tue Dec  4 07:55:19 2007
@@ -99,6 +99,7 @@
 };
 
 struct wc_usb_pvt {
+	const char *variety;
         struct usb_device *dev;
         dev_type_t devclass;
         int usecount;

Modified: branches/1.4/zaptel-base.c
URL: http://svn.digium.com/view/zaptel/branches/1.4/zaptel-base.c?view=diff&rev=3278&r1=3277&r2=3278
==============================================================================
--- branches/1.4/zaptel-base.c (original)
+++ branches/1.4/zaptel-base.c Tue Dec  4 07:55:19 2007
@@ -2947,8 +2947,7 @@
 {
 	union {
 		struct zt_gains gain;
-		struct zt_spaninfo span;
-		struct zt_spaninfo_compat span_compat;
+		struct zt_spaninfo spaninfo;
 		struct zt_params param;
 	} stack;
 	struct zt_chan *chan;
@@ -2957,6 +2956,7 @@
 	struct zt_chan *mychan;
 	int i,j;
 	int return_master = 0;
+	size_t size_to_copy;
 
 	switch(cmd) {
 	case ZT_GET_PARAMS: /* get channel timing parameters */
@@ -3131,43 +3131,60 @@
 		if (copy_to_user((struct zt_gains *) data,&stack.gain,sizeof(stack.gain)))
 			return -EFAULT;
 		break;
-	case ZT_SPANSTAT_COMPAT:
+	case ZT_SPANSTAT_V1:
+	case ZT_SPANSTAT_V2:
 	case ZT_SPANSTAT:
-		if (copy_from_user(&stack.span,(struct zt_spaninfo *) data, cmd == ZT_SPANSTAT_COMPAT ? sizeof(stack.span_compat) : sizeof(stack.span)))
+		size_to_copy = (cmd == ZT_SPANSTAT_V1) ? sizeof(struct zt_spaninfo_v1) :
+			       (cmd == ZT_SPANSTAT_V2) ? sizeof(struct zt_spaninfo_v2) :
+			       sizeof(struct zt_spaninfo);
+		if (copy_from_user(&stack.spaninfo, (struct zt_spaninfo *) data, size_to_copy))
 			return -EFAULT;
-		i = stack.span.spanno; /* get specified span number */
+		i = stack.spaninfo.spanno; /* get specified span number */
 		if ((i < 0) || (i >= maxspans)) return(-EINVAL);  /* if bad span no */
-		if (i == 0) /* if to figure it out for this chan */
-		   {
-		   	if (!chans[unit])
+		if (i == 0) {
+			/* if to figure it out for this chan */
+			if (!chans[unit])
 				return -EINVAL;
 			i = chans[unit]->span->spanno;
-		   }
+		}
 		if (!spans[i])
 			return -EINVAL;
-		stack.span.spanno = i; /* put the span # in here */
-		stack.span.totalspans = 0;
-		if (maxspans) stack.span.totalspans = maxspans - 1; /* put total number of spans here */
-		strncpy(stack.span.desc, spans[i]->desc, sizeof(stack.span.desc) - 1);
-		strncpy(stack.span.name, spans[i]->name, sizeof(stack.span.name) - 1);
-		stack.span.alarms = spans[i]->alarms;		/* get alarm status */
-		stack.span.bpvcount = spans[i]->bpvcount;	/* get BPV count */
-		stack.span.rxlevel = spans[i]->rxlevel;	/* get rx level */
-		stack.span.txlevel = spans[i]->txlevel;	/* get tx level */
-		stack.span.crc4count = spans[i]->crc4count;	/* get CRC4 error count */
-		stack.span.ebitcount = spans[i]->ebitcount;	/* get E-bit error count */
-		stack.span.fascount = spans[i]->fascount;	/* get FAS error count */
-		stack.span.irqmisses = spans[i]->irqmisses;	/* get IRQ miss count */
-		stack.span.syncsrc = spans[i]->syncsrc;	/* get active sync source */
-		stack.span.totalchans = spans[i]->channels;
-		/* We have space in the stack for these 2, even if they aren't copied back to userspace (for _COMPAT) */
-		stack.span.lbo = spans[i]->lbo;
-		stack.span.lineconfig = spans[i]->lineconfig;
-		stack.span.numchans = 0;
-		for (j=0; j < spans[i]->channels; j++)
+		stack.spaninfo.spanno = i; /* put the span # in here */
+		stack.spaninfo.totalspans = 0;
+		if (maxspans) stack.spaninfo.totalspans = maxspans - 1; /* put total number of spans here */
+		strncpy(stack.spaninfo.desc, spans[i]->desc, sizeof(stack.spaninfo.desc) - 1);
+		strncpy(stack.spaninfo.name, spans[i]->name, sizeof(stack.spaninfo.name) - 1);
+		stack.spaninfo.alarms = spans[i]->alarms;		/* get alarm status */
+		stack.spaninfo.bpvcount = spans[i]->bpvcount;	/* get BPV count */
+		stack.spaninfo.rxlevel = spans[i]->rxlevel;	/* get rx level */
+		stack.spaninfo.txlevel = spans[i]->txlevel;	/* get tx level */
+		stack.spaninfo.crc4count = spans[i]->crc4count;	/* get CRC4 error count */
+		stack.spaninfo.ebitcount = spans[i]->ebitcount;	/* get E-bit error count */
+		stack.spaninfo.fascount = spans[i]->fascount;	/* get FAS error count */
+		stack.spaninfo.irqmisses = spans[i]->irqmisses;	/* get IRQ miss count */
+		stack.spaninfo.syncsrc = spans[i]->syncsrc;	/* get active sync source */
+		stack.spaninfo.totalchans = spans[i]->channels;
+		stack.spaninfo.numchans = 0;
+		for (j = 0; j < spans[i]->channels; j++) {
 			if (spans[i]->chans[j].sig)
-				stack.span.numchans++;
-		if (copy_to_user((struct zt_spaninfo *) data,&stack.span, cmd == ZT_SPANSTAT_COMPAT ? sizeof(stack.span_compat) : sizeof(stack.span)))
+				stack.spaninfo.numchans++;
+		}
+		/* version 2 fields */
+		stack.spaninfo.lbo = spans[i]->lbo;
+		stack.spaninfo.lineconfig = spans[i]->lineconfig;
+		/* version 3 fields */
+		stack.spaninfo.irq = spans[i]->irq;
+		stack.spaninfo.linecompat = spans[i]->linecompat;
+		strncpy(stack.spaninfo.lboname, zt_lboname(spans[i]->lbo), sizeof(stack.spaninfo.lboname) - 1);
+		if (spans[i]->manufacturer)
+			strncpy(stack.spaninfo.manufacturer, spans[i]->manufacturer, sizeof(stack.spaninfo.manufacturer));
+		if (spans[i]->devicetype)
+			strncpy(stack.spaninfo.devicetype, spans[i]->devicetype, sizeof(stack.spaninfo.devicetype));
+		strncpy(stack.spaninfo.location, spans[i]->location, sizeof(stack.spaninfo.location));
+		if (spans[i]->spantype)
+			strncpy(stack.spaninfo.spantype, spans[i]->spantype, sizeof(stack.spaninfo.spantype));
+		
+		if (copy_to_user((struct zt_spaninfo *) data, &stack.spaninfo, size_to_copy))
 			return -EFAULT;
 		break;
 	case ZT_CHANDIAG:
@@ -3297,7 +3314,7 @@
 		if (copy_from_user(&lc, (struct zt_lineconfig *)data, sizeof(lc)))
 			return -EFAULT;
 		VALID_SPAN(lc.span);
-		if ((lc.lineconfig & 0xf0 & spans[lc.span]->linecompat) != (lc.lineconfig & 0xf0))
+		if ((lc.lineconfig & 0x07f0 & spans[lc.span]->linecompat) != (lc.lineconfig & 0x07f0))
 			return -EINVAL;
 		if (spans[lc.span]->spanconfig)
 			return spans[lc.span]->spanconfig(spans[lc.span], &lc);

Modified: branches/1.4/zaptel.h
URL: http://svn.digium.com/view/zaptel/branches/1.4/zaptel.h?view=diff&rev=3278&r1=3277&r2=3278
==============================================================================
--- branches/1.4/zaptel.h (original)
+++ branches/1.4/zaptel.h Tue Dec  4 07:55:19 2007
@@ -179,6 +179,7 @@
 
 /* Extended attributes in lineconfig structure */
 #define ZT_SPANINFO_HAS_LINECONFIG
+#define ZT_SPANINFO_HAS_LBONAME
 
 typedef struct zt_params
 {
@@ -208,44 +209,69 @@
 int	pulseaftertime;
 } ZT_PARAMS;
 
-typedef struct zt_spaninfo_compat
-{
-int	spanno;		/* span number */
-char name[20];	/* Name of span */
-char desc[40];	/* Description of span */
-int	alarms;		/* alarms status */
-int	txlevel;	/* what TX level is set to */
-int	rxlevel;	/* current RX level */
-int	bpvcount;	/* current BPV count */
-int	crc4count;	/* current CRC4 error count */
-int	ebitcount;	/* current E-bit error count */
-int	fascount;	/* current FAS error count */
-int	irqmisses;	/* current IRQ misses */
-int	syncsrc;	/* span # of current sync source, or 0 for free run  */
-int	numchans;	/* number of configured channels on this span */
-int	totalchans;	/* total number of channels on the span */
-int	totalspans;	/* total number of zaptel spans in entire system */
-} ZT_SPANINFO_COMPAT;
-
-typedef struct zt_spaninfo
-{
-int	spanno;		/* span number */
-char name[20];	/* Name of span */
-char desc[40];	/* Description of span */
-int	alarms;		/* alarms status */
-int	txlevel;	/* what TX level is set to */
-int	rxlevel;	/* current RX level */
-int	bpvcount;	/* current BPV count */
-int	crc4count;	/* current CRC4 error count */
-int	ebitcount;	/* current E-bit error count */
-int	fascount;	/* current FAS error count */
-int	irqmisses;	/* current IRQ misses */
-int	syncsrc;	/* span # of current sync source, or 0 for free run  */
-int	numchans;	/* number of configured channels on this span */
-int	totalchans;	/* total number of channels on the span */
-int	totalspans;	/* total number of zaptel spans in entire system */
-int	lbo;        /* line build out */
-int	lineconfig; /* framing/coding */
+struct zt_spaninfo_v1 {
+	int	spanno;		/* span number */
+	char	name[20];	/* Name */
+	char	desc[40];	/* Description */
+	int	alarms;		/* alarms status */
+	int	txlevel;	/* what TX level is set to */
+	int	rxlevel;	/* current RX level */
+	int	bpvcount;	/* current BPV count */
+	int	crc4count;	/* current CRC4 error count */
+	int	ebitcount;	/* current E-bit error count */
+	int	fascount;	/* current FAS error count */
+	int	irqmisses;	/* current IRQ misses */
+	int	syncsrc;	/* span # of current sync source, or 0 for free run  */
+	int	numchans;	/* number of configured channels on this span */
+	int	totalchans;	/* total number of channels on the span */
+	int	totaflspans;	/* total number of spans in entire system */
+};
+
+struct zt_spaninfo_v2 {
+	int	spanno;		/* span number */
+	char	name[20];	/* Name */
+	char	desc[40];	/* Description */
+	int	alarms;		/* alarms status */
+	int	txlevel;	/* what TX level is set to */
+	int	rxlevel;	/* current RX level */
+	int	bpvcount;	/* current BPV count */
+	int	crc4count;	/* current CRC4 error count */
+	int	ebitcount;	/* current E-bit error count */
+	int	fascount;	/* current FAS error count */
+	int	irqmisses;	/* current IRQ misses */
+	int	syncsrc;	/* span # of current sync source, or 0 for free run  */
+	int	numchans;	/* number of configured channels on this span */
+	int	totalchans;	/* total number of channels on the span */
+	int	totalspans;	/* total number of spans in entire system */
+	int	lbo;        	/* line build out */
+	int	lineconfig;	 /* framing/coding */
+};
+
+typedef struct zt_spaninfo {
+	int	spanno;		/* span number */
+	char	name[20];	/* Name */
+	char	desc[40];	/* Description */
+	int	alarms;		/* alarms status */
+	int	txlevel;	/* what TX level is set to */
+	int	rxlevel;	/* current RX level */
+	int	bpvcount;	/* current BPV count */
+	int	crc4count;	/* current CRC4 error count */
+	int	ebitcount;	/* current E-bit error count */
+	int	fascount;	/* current FAS error count */
+	int	irqmisses;	/* current IRQ misses */
+	int	syncsrc;	/* span # of current sync source, or 0 for free run  */
+	int	numchans;	/* number of configured channels on this span */
+	int	totalchans;	/* total number of channels on the span */
+	int	totalspans;	/* total number of spans in entire system */
+	int	lbo;		/* line build out */
+	int	lineconfig;	/* framing/coding */
+	char 	lboname[40];	/* line build out in text form */
+	char	location[40];	/* span's device location in system */
+	char	manufacturer[40]; /* manufacturer of span's device */
+	char	devicetype[40];	/* span's device type */
+	int	irq;		/* span's device IRQ */
+	int	linecompat;	/* signaling modes possible on this span */
+	char	spantype[6];	/* type of span in text form */
 } ZT_SPANINFO;
 
 typedef struct zt_maintinfo
@@ -408,9 +434,10 @@
 #define ZT_IOMUX		_IOWR (ZT_CODE, 9, int)
 
 /*
- * Get Span Status (_COMPAT is deprecated)
- */
-#define ZT_SPANSTAT_COMPAT		_IOWR (ZT_CODE, 10, struct zt_spaninfo_compat)
+ * Get Span Status
+ */
+#define ZT_SPANSTAT_V1		_IOWR (ZT_CODE, 10, struct zt_spaninfo_v1)
+#define ZT_SPANSTAT_V2		_IOWR (ZT_CODE, 10, struct zt_spaninfo_v2)
 #define ZT_SPANSTAT		_IOWR (ZT_CODE, 10, struct zt_spaninfo)
 
 /*
@@ -1391,6 +1418,10 @@
 	void *pvt;			/* Private stuff */
 	char name[40];			/* Span name */
 	char desc[80];			/* Span description */
+	const char *spantype;		/* span type in text form */
+	const char *manufacturer;	/* span's device manufacturer */
+	const char *devicetype;		/* span's device type */
+	char location[40];		/* span device's location in system */
 	int deflaw;			/* Default law (ZT_MULAW or ZT_ALAW) */
 	int alarms;			/* Pending alarms on span */
 	int flags;

Modified: branches/1.4/ztdummy.c
URL: http://svn.digium.com/view/zaptel/branches/1.4/ztdummy.c?view=diff&rev=3278&r1=3277&r2=3278
==============================================================================
--- branches/1.4/ztdummy.c (original)
+++ branches/1.4/ztdummy.c Tue Dec  4 07:55:19 2007
@@ -262,6 +262,7 @@
 	sprintf(ztd->span.name, "ZTDUMMY/1");
 	sprintf(ztd->span.desc, "%s (source: " CLOCK_SRC ") %d", ztd->span.name, 1);
 	sprintf(ztd->chan.name, "ZTDUMMY/%d/%d", 1, 0);
+	ztd->span.devicetype = "Zaptel Dummy Timing Driver";
 	ztd->chan.chanpos = 1;
 	ztd->span.chans = &ztd->chan;
 	ztd->span.channels = 0;		/* no channels on our span */




More information about the zaptel-commits mailing list