[zaptel-commits] kpfleming: branch mogorman/zaptel-1.2-transcoder r1908 - /team/mogorman/zapte...

zaptel-commits at lists.digium.com zaptel-commits at lists.digium.com
Mon Jan 22 17:53:49 MST 2007


Author: kpfleming
Date: Mon Jan 22 18:53:48 2007
New Revision: 1908

URL: http://svn.digium.com/view/zaptel?view=rev&rev=1908
Log:
remove test harness code and add debug_cmd_packets parameter (patch from jsloan)

Modified:
    team/mogorman/zaptel-1.2-transcoder/wctc4xxb/base.c

Modified: team/mogorman/zaptel-1.2-transcoder/wctc4xxb/base.c
URL: http://svn.digium.com/view/zaptel/team/mogorman/zaptel-1.2-transcoder/wctc4xxb/base.c?view=diff&rev=1908&r1=1907&r2=1908
==============================================================================
--- team/mogorman/zaptel-1.2-transcoder/wctc4xxb/base.c (original)
+++ team/mogorman/zaptel-1.2-transcoder/wctc4xxb/base.c Mon Jan 22 18:53:48 2007
@@ -377,6 +377,7 @@
 static int debug = 0;
 static char *mode;
 int debug_packets = 0;
+int debug_cmd_packets = 0;
 
 static int create_channel(struct wcdte *wc, int simple, int complicated, int part1_id, int part2_id, unsigned int *dte_chan1, unsigned int *dte_chan2);
 static int destroy_channel(struct wcdte *wc, unsigned int chan1, unsigned int chan2);
@@ -506,13 +507,20 @@
 	for (j = i; j < xmt_length; j++)
 		writechunk[j] = 0;
 
-	if (debug_packets && (writechunk[12] == 0x88) && (writechunk[13] == 0x9B)) {
+	if (debug_packets) {
 		printk("wcdte debug: TX: ");
 		for (i = 0; i < debug_packets; i++)
 			printk("%02X ", writechunk[i]);
 		printk("\n");
 	}
 
+	if (debug_cmd_packets && (writechunk[12] == 0x88) && (writechunk[13] == 0x9B)) {
+		printk("wcdte debug: TX: ");
+		for (i = 0; i < debug_cmd_packets; i++)
+			printk("%02X ", writechunk[i]);
+		printk("\n");
+	}
+
 	wc->cmdq[wc->cmdq_rndx].cmdlen = 0;
 
 	wc->descripchunk[o2] = cpu_to_le32(0x80000000);
@@ -534,77 +542,6 @@
 	up(&wc->cmdqsem);
 
 	return val;
-}
-
-unsigned int test_seqno;
-unsigned int test_timestamp;
-unsigned int emc_errorcnt;
-unsigned int emc_rcvd;
-
-static int send_test_packet(struct wcdte *wc)
-{
-	unsigned int inbytes = 0;
-	unsigned int timestamp_inc = 0;
-	int i = 0;
-	unsigned long flags;
-	unsigned int ipchksum;
-				
-	inbytes = 160;
-	timestamp_inc = 160;
-
-	{
-		unsigned char fifo[300] = CMD_MSG_IP_UDP_RTP(
-			 ((inbytes+40) >> 8)              & 0xFF,
-			  (inbytes+40)                    & 0xFF,
-			   test_seqno                      & 0xFF,
-			   0x00,
-			   0x00,
-			   0x50,
-			   0x01,
-			   0x50,
-			   0x00,
-			 ((inbytes+20) >> 8)              & 0xFF,
-			  (inbytes+20)                    & 0xFF,
-			   0x00,
-			   0x00,
-			   0x00,					 
-			 ((test_seqno) >> 8)              & 0xFF, /* Sequence number */
-			  (test_seqno)                    & 0xFF,
-			 ((test_timestamp) >> 24)         & 0xFF,
-			 ((test_timestamp) >> 16)         & 0xFF,
-			 ((test_timestamp) >> 8)          & 0xFF,
-			  (test_timestamp)                & 0xFF);
-
-		ipchksum = 0x9869 + (fifo[14+2*1] << 8) + fifo[15+2*1] + (fifo[14+2*2] << 8) + fifo[15+2*2];
-		while (ipchksum >> 16)
-			ipchksum = (ipchksum & 0xFFFF) + (ipchksum >> 16);
-		ipchksum = (~ipchksum) & 0xFFFF;
-
-		fifo[24] = ipchksum >> 8;
-		fifo[25] = ipchksum & 0xFF;
-
-		test_seqno += 1;
-		test_timestamp += timestamp_inc;
-
-		for (i = 0; i < inbytes; i++)
-			fifo[i+CMD_MSG_IP_UDP_RTP_LEN]= 0xAA;
-
-		spin_lock_irqsave(&wc->reglock, flags);
-		if (((wc->cmdq_wndx + 1) % MAX_COMMANDS) == wc->cmdq_rndx)
-			printk("ERROR: cmdq is full.  This is CRITICAL.\n");
-		else
-		{
-			wc->cmdq[wc->cmdq_wndx].cmdlen = CMD_MSG_IP_UDP_RTP_LEN+inbytes;
-			for (i = 0; i < CMD_MSG_IP_UDP_RTP_LEN+inbytes; i++)
-				wc->cmdq[wc->cmdq_wndx].cmd[i] = fifo[i];
-			wc->cmdq_wndx = (wc->cmdq_wndx + 1) % MAX_COMMANDS;
-		}
-		spin_unlock_irqrestore(&wc->reglock, flags);
-	}
-
-	transmit_demand(wc);
-
-	return 0;
 }
 
 static int dte_operation(struct zt_transcoder_channel *ztc, int op)
@@ -616,23 +553,11 @@
 	unsigned char *chars;
 	unsigned int inbytes = 0;
 	unsigned int timestamp_inc = 0;
-	int i = 0, j = 0, reg = 0;
+	int i = 0;
 	int res = 0;
 	unsigned int ipchksum, ndx;
 
 	switch(op) {
-	case ZT_TCOP_TEST:
-		printk("Starting EMC Loop test\n");
-		do {
-			send_test_packet(wc);
-			if ((j % 50) == 0) {
-				reg = getctl(wc, 0x00fc);
-				printk(KERN_EMERG "sent = %d, received = %d, bad = %d, reg 0xFC = %X\n", j, emc_rcvd, emc_errorcnt, reg);
-			}
-			j++;
-			mdelay(20);
-		} while (j < 15000); /* Time for test */
-		break;
 	case ZT_TCOP_RESET:
 		down(&wc->chansem);
 		if (ztc->chan_built == 0) {
@@ -819,11 +744,18 @@
 	o2 = dbl * 4;
 	o2 += ERING_SIZE * 4;
 	
+	if (debug_packets) {
+		printk("wctc4xxb: RX: ");
+		for (i = 0; i < debug_packets; i++)
+			printk("%02X", readchunk[i]);
+		printk("\n");
+	}
+
 	if ((readchunk[12] == 0x88) && (readchunk[13] == 0x9B)) {
 		/* Control in packet */
-		if (debug_packets) {
+		if (debug_cmd_packets) {
 			printk("wcdte debug: RX: ");
-			for (i = 0; i < debug_packets; i++)
+			for (i = 0; i < debug_cmd_packets; i++)
 				printk("%02X ", readchunk[i]);
 			printk("\n");
 		}
@@ -1767,6 +1699,8 @@
 
 module_param(debug, int, 0600);
 module_param(mode, charp, 0600);
+module_param(debug_packets, int, 0600);
+module_param(debug_cmd_packets, int, 0600);
 MODULE_DESCRIPTION("Wildcard TC400B Transcoder");
 MODULE_AUTHOR("John Sloan <jsloan at digium.com>");
 MODULE_LICENSE("GPL");



More information about the zaptel-commits mailing list