[Pkg-voip-commits] r6098 - in /dahdi-linux/trunk: debian/TODO.Debian debian/patches/bri_dchan debian/rules drivers/dahdi/zaphfc.c drivers/dahdi/zaphfc.h

tzafrir-guest at alioth.debian.org tzafrir-guest at alioth.debian.org
Tue Aug 26 19:00:29 UTC 2008


Author: tzafrir-guest
Date: Tue Aug 26 19:00:29 2008
New Revision: 6098

URL: http://svn.debian.org/wsvn/pkg-voip/?sc=1&rev=6098
Log:
zaphfc builds. Required fixing bri_dchan.

Modified:
    dahdi-linux/trunk/debian/TODO.Debian
    dahdi-linux/trunk/debian/patches/bri_dchan
    dahdi-linux/trunk/debian/rules
    dahdi-linux/trunk/drivers/dahdi/zaphfc.c
    dahdi-linux/trunk/drivers/dahdi/zaphfc.h

Modified: dahdi-linux/trunk/debian/TODO.Debian
URL: http://svn.debian.org/wsvn/pkg-voip/dahdi-linux/trunk/debian/TODO.Debian?rev=6098&op=diff
==============================================================================
--- dahdi-linux/trunk/debian/TODO.Debian (original)
+++ dahdi-linux/trunk/debian/TODO.Debian Tue Aug 26 19:00:29 2008
@@ -2,3 +2,4 @@
 * Add some lintian ignore lines.
 * Fix other modules.
 * Do we build oslec internally??
+* Rename *zap* modules to *dahdi*?

Modified: dahdi-linux/trunk/debian/patches/bri_dchan
URL: http://svn.debian.org/wsvn/pkg-voip/dahdi-linux/trunk/debian/patches/bri_dchan?rev=6098&op=diff
==============================================================================
--- dahdi-linux/trunk/debian/patches/bri_dchan (original)
+++ dahdi-linux/trunk/debian/patches/bri_dchan Tue Aug 26 19:00:29 2008
@@ -29,7 +29,7 @@
  };
  
 +#if defined(CONFIG_DAHDI_BRI_DCHANS)
-+#define DAHDI_FLAG_BRIDCHAN		(1 << (int)DAHDI_FLAG_BRIDCHAN)
++#define DAHDI_FLAG_BRIDCHAN		(1 << (int)DAHDI_FLAGBIT_BRIDCHAN)
 +#endif
 +
  struct dahdi_span {

Modified: dahdi-linux/trunk/debian/rules
URL: http://svn.debian.org/wsvn/pkg-voip/dahdi-linux/trunk/debian/rules?rev=6098&op=diff
==============================================================================
--- dahdi-linux/trunk/debian/rules (original)
+++ dahdi-linux/trunk/debian/rules Tue Aug 26 19:00:29 2008
@@ -45,6 +45,7 @@
 
 #EXTRA_MODS=ds1x1f opvxa1200
 
+EXTRA_MODS=zaphfc
 ifneq (,$(filter-out powerpc m68k armeb mips,$(shell dpkg-architecture -qDEB_HOST_ARCH)))
 EXTRA_MODS += wcopenpci
 endif

Modified: dahdi-linux/trunk/drivers/dahdi/zaphfc.c
URL: http://svn.debian.org/wsvn/pkg-voip/dahdi-linux/trunk/drivers/dahdi/zaphfc.c?rev=6098&op=diff
==============================================================================
--- dahdi-linux/trunk/drivers/dahdi/zaphfc.c (original)
+++ dahdi-linux/trunk/drivers/dahdi/zaphfc.c Tue Aug 26 19:00:29 2008
@@ -24,12 +24,10 @@
 #include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/delay.h>
-#include <zaptel.h>
+#include <dahdi/kernel.h>
 #include "zaphfc.h"
 
-#ifdef LINUX26
 #include <linux/moduleparam.h>
-#endif
 
 #if CONFIG_PCI
 
@@ -131,9 +129,9 @@
     }
     spin_unlock_irqrestore(&hfctmp->lock,flags);
     if (hfctmp->ztdev != NULL) {
-	zt_unregister(&hfctmp->ztdev->span);
+	dahdi_unregister(&hfctmp->ztdev->span);
 	kfree(hfctmp->ztdev);
-	printk(KERN_INFO "unregistered from zaptel.\n");
+	printk(KERN_INFO "unregistered from DAHDI.\n");
     }
 }
 
@@ -255,7 +253,7 @@
     if (freebytes <= 0) {
 	freebytes += hfc_B_FIFO_SIZE;
     }
-    count = ZT_CHUNKSIZE;
+    count = DAHDI_CHUNKSIZE;
 
     total = count;
     if (freebytes < count) {
@@ -320,19 +318,19 @@
     if (bytes < 0) {
 	bytes += hfc_B_FIFO_SIZE;
     }
-    count = ZT_CHUNKSIZE;
-    
-    if (bytes < ZT_CHUNKSIZE) {
+    count = DAHDI_CHUNKSIZE;
+    
+    if (bytes < DAHDI_CHUNKSIZE) {
 #ifndef RTAITIMING
-	printk(KERN_CRIT "zaphfc: bchan rx fifo not enough bytes to receive! (z1=%d, z2=%d, wanted %d got %d), probably a buffer overrun.\n",*z1,*z2,ZT_CHUNKSIZE,bytes);
+	printk(KERN_CRIT "zaphfc: bchan rx fifo not enough bytes to receive! (z1=%d, z2=%d, wanted %d got %d), probably a buffer overrun.\n",*z1,*z2,DAHDI_CHUNKSIZE,bytes);
 #endif
 	return;
     }
 
     /* allowing the buffering of hfc_BCHAN_BUFFER bytes of audio data works around irq jitter */
-    if (bytes > hfc_BCHAN_BUFFER + ZT_CHUNKSIZE) {
-	/* if the system is too slow to handle it, we will have to drop it all (except 1 zaptel chunk) */
-	drop = bytes - ZT_CHUNKSIZE;
+    if (bytes > hfc_BCHAN_BUFFER + DAHDI_CHUNKSIZE) {
+	/* if the system is too slow to handle it, we will have to drop it all (except 1 DAHDI chunk) */
+	drop = bytes - DAHDI_CHUNKSIZE;
 	hfctmp->clicks++;
 	/* only spit out this warning once per second to not make things worse! */
 	if (hfctmp->clicks > 100) {
@@ -381,9 +379,9 @@
 
 
     if (whichB == 1) {
-	zt_ec_chunk(&hfctmp->ztdev->chans[0], hfctmp->ztdev->chans[0].readchunk, hfctmp->ztdev->chans[0].writechunk);
+	dahdi_ec_chunk(&hfctmp->ztdev->chans[0], hfctmp->ztdev->chans[0].readchunk, hfctmp->ztdev->chans[0].writechunk);
     } else {
-	zt_ec_chunk(&hfctmp->ztdev->chans[1], hfctmp->ztdev->chans[1].readchunk, hfctmp->ztdev->chans[1].writechunk);
+	dahdi_ec_chunk(&hfctmp->ztdev->chans[1], hfctmp->ztdev->chans[1].readchunk, hfctmp->ztdev->chans[1].writechunk);
     }
     return;    
 }
@@ -475,8 +473,8 @@
     hfctmp->ztdev->chans[2].bytes2receive=0;
     hfctmp->ztdev->chans[2].eofrx = 0;
 
-    /* put the received data into the zaptel buffer
-       we'll call zt_receive() later when the timer fires. */
+    /* put the received data into the DAHDI buffer
+       we'll call dahdi_receive() later when the timer fires. */
     f1 = (char *)(hfctmp->fifos + hfc_FIFO_DRX_F1);
     f2 = (char *)(hfctmp->fifos + hfc_FIFO_DRX_F2);
 
@@ -543,24 +541,20 @@
 }
 
 #ifndef RTAITIMING
-ZAP_IRQ_HANDLER(hfc_interrupt) {
+DAHDI_IRQ_HANDLER(hfc_interrupt) {
     struct hfc_card *hfctmp = dev_id;
     unsigned long flags = 0;
     unsigned char stat;
 #else
 static void hfc_service(struct hfc_card *hfctmp) {
 #endif
-    struct zt_hfc *zthfc;
+    struct dahdi_hfc *zthfc;
     unsigned char s1, s2, l1state;
     int x;
 
     if (!hfctmp) {
 #ifndef RTAITIMING
-#ifdef LINUX26
 		return IRQ_NONE;
-#else
-		return;
-#endif		
 #else
 	/* rtai */
 	return;
@@ -571,11 +565,7 @@
 	    printk(KERN_WARNING "%s: IO-mem disabled, cannot handle interrupt\n",
 		   __FUNCTION__);
 #ifndef RTAITIMING
-#ifdef LINUX26
 	    return IRQ_NONE;
-#else
-	    return;
-#endif		
 #else
 	/* rtai */
 	return;
@@ -599,11 +589,7 @@
     if ((stat & hfc_STATUS_ANYINT) == 0) {
         // maybe we are sharing the irq
 	spin_unlock_irqrestore(&hfctmp->lock,flags);
-#ifdef LINUX26
 	return IRQ_NONE;
-#else
-	return;
-#endif		
     }
 #endif
 
@@ -712,16 +698,16 @@
 	    hfctmp->ticks++;
 #ifndef RTAITIMING
 	    if (hfctmp->ticks > 7) {
-		// welcome to zaptel timing :)
+		// welcome to DAHDI timing :)
 #endif
 	    	hfctmp->ticks = 0;
 
-		if (hfctmp->ztdev->span.flags & ZT_FLAG_RUNNING) {
+		if (hfctmp->ztdev->span.flags & DAHDI_FLAG_RUNNING) {
 		    // clear dchan buffer
 		    hfctmp->ztdev->chans[2].bytes2transmit = 0;
 		    hfctmp->ztdev->chans[2].maxbytes2transmit = hfc_D_FIFO_SIZE;
 
-		    zt_transmit(&(hfctmp->ztdev->span));
+		    dahdi_transmit(&(hfctmp->ztdev->span));
 
 		    hfc_btrans(hfctmp,1);
 		    hfc_btrans(hfctmp,2);
@@ -751,11 +737,11 @@
 			    }
 		    }
 		} else {
-			// hmm....ok, let zaptel receive nothing
+			// hmm....ok, let DAHDI receive nothing
 		    hfctmp->ztdev->chans[2].bytes2receive = 0;
 		}
-		if (hfctmp->ztdev->span.flags & ZT_FLAG_RUNNING) {
-		    zt_receive(&(hfctmp->ztdev->span));
+		if (hfctmp->ztdev->span.flags & DAHDI_FLAG_RUNNING) {
+		    dahdi_receive(&(hfctmp->ztdev->span));
 		}
 		
 #ifndef RTAITIMING
@@ -766,49 +752,39 @@
     }
 #ifndef RTAITIMING
     spin_unlock_irqrestore(&hfctmp->lock,flags);
-#ifdef LINUX26
 	return IRQ_RETVAL(1);
-#endif		
-#endif
-}
-
-
-static int zthfc_open(struct zt_chan *chan) {
-    struct zt_hfc *zthfc = chan->pvt;
+#endif
+}
+
+
+static int zthfc_open(struct dahdi_chan *chan) {
+    struct dahdi_hfc *zthfc = chan->pvt;
     struct hfc_card *hfctmp = zthfc->card;
     
     if (!hfctmp) {
     return 0;
     }
-#ifndef LINUX26  
-    MOD_INC_USE_COUNT;
-#else
     try_module_get(THIS_MODULE);
-#endif
     return 0;
 }
 
-static int zthfc_close(struct zt_chan *chan) {
-    struct zt_hfc *zthfc = chan->pvt;
+static int zthfc_close(struct dahdi_chan *chan) {
+    struct dahdi_hfc *zthfc = chan->pvt;
     struct hfc_card *hfctmp = zthfc->card;
 
     if (!hfctmp) {
 	return 0;
     }
 
-#ifndef LINUX26  
-    MOD_DEC_USE_COUNT;
-#else
     module_put(THIS_MODULE);
-#endif
     return 0;
 }
 
-static int zthfc_rbsbits(struct zt_chan *chan, int bits) {
+static int zthfc_rbsbits(struct dahdi_chan *chan, int bits) {
     return 0;
 }
 
-static int zthfc_ioctl(struct zt_chan *chan, unsigned int cmd, unsigned long data) {
+static int zthfc_ioctl(struct dahdi_chan *chan, unsigned int cmd, unsigned long data) {
         switch(cmd) {
         default:
                 return -ENOTTY;
@@ -816,21 +792,21 @@
         return 0;
 }
 
-static int zthfc_startup(struct zt_span *span) {
-    struct zt_hfc *zthfc = span->pvt;
+static int zthfc_startup(struct dahdi_span *span) {
+    struct dahdi_hfc *zthfc = span->pvt;
     struct hfc_card *hfctmp = zthfc->card;
     int alreadyrunning;
     
     if (hfctmp == NULL) {
 	printk(KERN_INFO "zaphfc: no card for span at startup!\n");
     }
-    alreadyrunning = span->flags & ZT_FLAG_RUNNING;
+    alreadyrunning = span->flags & DAHDI_FLAG_RUNNING;
     
     if (!alreadyrunning) {
-	span->chans[2].flags &= ~ZT_FLAG_HDLC;
-	span->chans[2].flags |= ZT_FLAG_BRIDCHAN;
+	span->chans[2]->flags &= ~DAHDI_FLAG_HDLC;
+	span->chans[2]->flags |= DAHDI_FLAG_BRIDCHAN;
 	
-	span->flags |= ZT_FLAG_RUNNING;
+	span->flags |= DAHDI_FLAG_RUNNING;
 
 	hfctmp->ticks = -2;
 	hfctmp->clicks = 0;
@@ -845,29 +821,29 @@
     return 0;
 }
 
-static int zthfc_shutdown(struct zt_span *span) {
+static int zthfc_shutdown(struct dahdi_span *span) {
     return 0;
 }
 
-static int zthfc_maint(struct zt_span *span, int cmd) {
+static int zthfc_maint(struct dahdi_span *span, int cmd) {
     return 0;
 }
 
-static int zthfc_chanconfig(struct zt_chan *chan, int sigtype) {
+static int zthfc_chanconfig(struct dahdi_chan *chan, int sigtype) {
 //    printk(KERN_CRIT "chan_config sigtype=%d\n", sigtype);
     return 0;
 }
 
-static int zthfc_spanconfig(struct zt_span *span, struct zt_lineconfig *lc) {
+static int zthfc_spanconfig(struct dahdi_span *span, struct dahdi_lineconfig *lc) {
     span->lineconfig = lc->lineconfig;
     return 0;
 }
 
-static int zthfc_initialize(struct zt_hfc *zthfc) {
+static int zthfc_initialize(struct dahdi_hfc *zthfc) {
     struct hfc_card *hfctmp = zthfc->card;
     int i;
 
-    memset(&zthfc->span, 0x0, sizeof(struct zt_span)); // you never can tell...
+    memset(&zthfc->span, 0x0, sizeof(struct dahdi_span)); // you never can tell...
 
     sprintf(zthfc->span.name, "ZTHFC%d", hfc_dev_count + 1);
     if (hfctmp->regs.nt_mode == 1) {
@@ -894,27 +870,28 @@
     zthfc->span.close = zthfc_close;
     zthfc->span.ioctl = zthfc_ioctl;
 
-    zthfc->span.chans = zthfc->chans;
+    for (i = 0; i < zthfc->span.channels; i++)
+    	zthfc->span.chans[i] = &zthfc->chans[i];
     zthfc->span.channels = 3;
-    zthfc->span.deflaw = ZT_LAW_ALAW;
-    zthfc->span.linecompat = ZT_CONFIG_AMI | ZT_CONFIG_CCS; // <--- this is really BS
+    zthfc->span.deflaw = DAHDI_LAW_ALAW;
+    zthfc->span.linecompat = DAHDI_CONFIG_AMI | DAHDI_CONFIG_CCS; // <--- this is really BS
     zthfc->span.offset = 0;
     init_waitqueue_head(&zthfc->span.maintq);
     zthfc->span.pvt = zthfc;
 
     for (i = 0; i < zthfc->span.channels; i++) {
-	memset(&(zthfc->chans[i]), 0x0, sizeof(struct zt_chan));
+	memset(&(zthfc->chans[i]), 0x0, sizeof(struct dahdi_chan));
 	sprintf(zthfc->chans[i].name, "ZTHFC%d/%d/%d", hfc_dev_count + 1,0,i + 1);
 	zthfc->chans[i].pvt = zthfc;
-	zthfc->chans[i].sigcap =  ZT_SIG_EM | ZT_SIG_CLEAR | ZT_SIG_FXSLS | ZT_SIG_FXSGS | ZT_SIG_FXSKS | ZT_SIG_FXOLS | ZT_SIG_FXOGS | ZT_SIG_FXOKS | ZT_SIG_CAS | ZT_SIG_SF;
+	zthfc->chans[i].sigcap =  DAHDI_SIG_EM | DAHDI_SIG_CLEAR | DAHDI_SIG_FXSLS | DAHDI_SIG_FXSGS | DAHDI_SIG_FXSKS | DAHDI_SIG_FXOLS | DAHDI_SIG_FXOGS | DAHDI_SIG_FXOKS | DAHDI_SIG_CAS | DAHDI_SIG_SF;
 	zthfc->chans[i].chanpos = i + 1; 
     }
 
-    if (zt_register(&zthfc->span,0)) {
-	printk(KERN_CRIT "unable to register zaptel device!\n");
+    if (dahdi_register(&zthfc->span,0)) {
+	printk(KERN_CRIT "unable to register DAHDI device!\n");
 	return -1;
     }
-//    printk(KERN_CRIT "zaphfc: registered zaptel device!\n");
+//    printk(KERN_CRIT "zaphfc: registered DAHDI device!\n");
     return 0;
 }
 
@@ -947,7 +924,7 @@
 int hfc_findCards(int pcivendor, int pcidevice, char *vendor_name, char *card_name) {
     struct pci_dev *tmp;
     struct hfc_card *hfctmp = NULL;
-    struct zt_hfc *zthfc = NULL;
+    struct dahdi_hfc *zthfc = NULL;
 
     tmp = pci_get_device(pcivendor, pcidevice, multi_hfc);
     while (tmp != NULL) {
@@ -1006,7 +983,7 @@
 	/* we need no stinking irq */
 	hfctmp->irq = 0;
 #else
-	if (request_irq(hfctmp->irq, &hfc_interrupt, ZAP_IRQ_SHARED, "zaphfc", hfctmp)) {
+	if (request_irq(hfctmp->irq, &hfc_interrupt, DAHDI_IRQ_SHARED, "zaphfc", hfctmp)) {
 	    printk(KERN_WARNING "zaphfc: unable to register irq\n");
 	    kfree(hfctmp->fifomem);
 	    kfree(hfctmp);
@@ -1041,7 +1018,7 @@
 	    hfctmp->regs.nt_mode = 0;
 	}
 
-	zthfc = kmalloc(sizeof(struct zt_hfc),GFP_KERNEL);
+	zthfc = kmalloc(sizeof(struct dahdi_hfc),GFP_KERNEL);
 	if (!zthfc) {
 	    printk(KERN_CRIT "zaphfc: unable to kmalloc!\n");
 	    hfc_shutdownCard(hfctmp);
@@ -1049,7 +1026,7 @@
 	    multi_hfc = NULL;
 	    return -ENOMEM;
 	}
-	memset(zthfc, 0x0, sizeof(struct zt_hfc));
+	memset(zthfc, 0x0, sizeof(struct dahdi_hfc));
 
 	zthfc->card = hfctmp;
 	zthfc_initialize(zthfc);
@@ -1140,13 +1117,8 @@
 #endif
 
 
-#ifdef LINUX26
 module_param(modes, int, 0600);
 module_param(debug, int, 0600);
-#else
-MODULE_PARM(modes,"i");
-MODULE_PARM(debug,"i");
-#endif
 
 MODULE_DESCRIPTION("HFC-S PCI A Zaptel Driver");
 MODULE_AUTHOR("Klaus-Peter Junghanns <kpj at junghanns.net>");

Modified: dahdi-linux/trunk/drivers/dahdi/zaphfc.h
URL: http://svn.debian.org/wsvn/pkg-voip/dahdi-linux/trunk/drivers/dahdi/zaphfc.h?rev=6098&op=diff
==============================================================================
--- dahdi-linux/trunk/drivers/dahdi/zaphfc.h (original)
+++ dahdi-linux/trunk/drivers/dahdi/zaphfc.h Tue Aug 26 19:00:29 2008
@@ -267,22 +267,22 @@
     unsigned int pcibus;
     unsigned int pcidevfn;
     struct pci_dev *pcidev;
-    struct zt_hfc *ztdev;
+    struct dahdi_hfc *ztdev;
     int	drecinframe;
     unsigned char drecbuf[hfc_D_FIFO_SIZE];
     unsigned char dtransbuf[hfc_D_FIFO_SIZE];
-    unsigned char brecbuf[2][ZT_CHUNKSIZE];
-    unsigned char btransbuf[2][ZT_CHUNKSIZE];
+    unsigned char brecbuf[2][DAHDI_CHUNKSIZE];
+    unsigned char btransbuf[2][DAHDI_CHUNKSIZE];
     unsigned char cardno;
     struct hfc_card *next;
 } hfc_card;
 
-typedef struct zt_hfc {
+typedef struct dahdi_hfc {
     unsigned int usecount;
-    struct zt_span span;
-    struct zt_chan chans[3];
+    struct dahdi_span span;
+    struct dahdi_chan chans[3];
     struct hfc_card *card;
-} zt_hfc;
+} dahdi_hfc;
 
 /* tune this */
 #define hfc_BCHAN_BUFFER	8




More information about the Pkg-voip-commits mailing list