[svn-commits] mogorman: trunk r1560 - /trunk/ztcodec_dte.c

svn-commits at lists.digium.com svn-commits at lists.digium.com
Mon Nov 6 14:03:05 MST 2006


Author: mogorman
Date: Mon Nov  6 15:03:05 2006
New Revision: 1560

URL: http://svn.digium.com/view/zaptel?rev=1560&view=rev
Log:
Reduces dma memory requirement and fixes multi card support
-John Sloan

Modified:
    trunk/ztcodec_dte.c

Modified: trunk/ztcodec_dte.c
URL: http://svn.digium.com/view/zaptel/trunk/ztcodec_dte.c?rev=1560&r1=1559&r2=1560&view=diff
==============================================================================
--- trunk/ztcodec_dte.c (original)
+++ trunk/ztcodec_dte.c Mon Nov  6 15:03:05 2006
@@ -87,7 +87,7 @@
 
 #define MAX_COMMAND_LEN BOOT_CMD_LEN	/* Must be the larger of BOOT_CMD_LEN or OTHER_CMD_LEN */
 
-#define ERING_SIZE (NUM_CHANNELS * 2)		/* Maximum ring size */
+#define ERING_SIZE (NUM_CHANNELS / 2)		/* Maximum ring size */
 
 #define SFRAME_SIZE MAX_COMMAND_LEN
 
@@ -264,6 +264,9 @@
 	volatile unsigned int *writechunk;					/* Double-word aligned write memory */
 	volatile unsigned int *readchunk;					/* Double-word aligned read memory */
 	volatile unsigned int *descripchunk;					/* Descriptors */
+	
+	struct zt_transcoder *uencode;
+	struct zt_transcoder *udecode;
 };
 
 struct wcdte_desc {
@@ -661,7 +664,7 @@
 
 		if ((rcodec == 0x00) || (rcodec == 0x08))	/* ulaw or alaw (decoders) */
 		{
-			ztc = &(udecode->channels[ztc_ndx]);
+			ztc = &(wc->udecode->channels[ztc_ndx]);
 			zth = ztc->tch;
 			st = ztc->pvt;
 
@@ -679,7 +682,7 @@
 		
 		if ((rcodec == 0x04) || (rcodec == 0x12))	/* g.723 or g.729 (encoders) */
 		{
-			ztc = &(uencode->channels[ztc_ndx]);
+			ztc = &(wc->uencode->channels[ztc_ndx]);
 			zth = ztc->tch;
 			st = ztc->pvt;
 
@@ -1052,8 +1055,8 @@
 	/* Set reset */
 	wcdte_setctl(wc, 0x00A0, 0x04000000);
 
-	/* Wait 300msec to ensure processor reset */
-	mdelay(300);
+	/* Wait 1000msec to ensure processor reset */
+	mdelay(1000);
 
 	/* Clear reset */
 	wcdte_setctl(wc, 0x00A0, 0x04080000);
@@ -1303,6 +1306,9 @@
 				uencode->channels[x].pvt = encoders + x;
 				udecode->channels[x].pvt = decoders + x;
 			}
+
+			wc->uencode = uencode;
+			wc->udecode = udecode;
 		
 			zt_transcoder_register(uencode);
 			zt_transcoder_register(udecode);
@@ -1402,6 +1408,14 @@
 	struct wcdte *wc = pci_get_drvdata(pdev);
 
 	if (wc) {
+		
+		zt_transcoder_unregister(wc->udecode);
+		zt_transcoder_unregister(wc->uencode);
+		zt_transcoder_free(wc->uencode);
+		zt_transcoder_free(wc->udecode);
+		vfree(wc->uencode->channels[0].pvt);
+		vfree(wc->udecode->channels[0].pvt);
+	
 		/* Stop any DMA */
 		wcdte_stop_dma(wc);
 
@@ -1456,8 +1470,9 @@
 
 void ztdte_cleanup(void)
 {
-	int i;
-
+// 	int i;
+
+#if 0
 	if (debug)
 	{
 		for(i = 0; i < NUM_CHANNELS; i++)
@@ -1466,15 +1481,10 @@
 			printk("decoder[%d] packets_sent = %d, packets_received = %d [%d]\n", i, decoders[i].packets_sent, decoders[i].packets_received, decoders[i].packets_sent - decoders[i].packets_received);
 		}
 	}
+#endif
 
 	pci_unregister_driver(&wcdte_driver);
 
-	zt_transcoder_unregister(udecode);
-	zt_transcoder_unregister(uencode);
-	zt_transcoder_free(uencode);
-	zt_transcoder_free(udecode);
-	vfree(encoders);
-	vfree(decoders);
 	printk("Zaptel DTE (G.729/G.723) Transcoder support unloaded.\n");
 
 }



More information about the svn-commits mailing list