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

zaptel-commits at lists.digium.com zaptel-commits at lists.digium.com
Tue Jan 30 15:02:51 MST 2007


Author: kpfleming
Date: Tue Jan 30 16:02:50 2007
New Revision: 2027

URL: http://svn.digium.com/view/zaptel?view=rev&rev=2027
Log:
some more debugging code

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

Modified: team/mogorman/zaptel-1.2-transcoder/wctc4xxp/base.c
URL: http://svn.digium.com/view/zaptel/team/mogorman/zaptel-1.2-transcoder/wctc4xxp/base.c?view=diff&rev=2027&r1=2026&r2=2027
==============================================================================
--- team/mogorman/zaptel-1.2-transcoder/wctc4xxp/base.c (original)
+++ team/mogorman/zaptel-1.2-transcoder/wctc4xxp/base.c Tue Jan 30 16:02:50 2007
@@ -314,6 +314,21 @@
 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);
 
+static void dump_cmdq(struct wcdte *wc)
+{
+	struct cmdq *cmdq;
+
+	debug_printk(1, "pending_cmdq: ");
+	list_for_each_entry(cmdq, &wc->pending_cmdq, list)
+		printk("%p(%zd) ", cmdq, cmdq->cmdspace);
+	printk("\n");
+
+	debug_printk(1, "free_cmdq: ");
+	list_for_each_entry(cmdq, &wc->free_cmdq, list)
+		printk("%p(%zd) ", cmdq, cmdq->cmdspace);
+	printk("\n");
+}
+
 static struct cmdq *get_free_cmdq(struct wcdte *wc, size_t size_needed)
 {
 	struct cmdq *winner = NULL;
@@ -353,6 +368,8 @@
 		return candidate;
 	} else if (wc->total_cmdq < MAX_TOTAL_CMDQ) {
 		/* we can make a new entry */
+		if (debug)
+			dump_cmdq(wc);
 		if ((winner = kmalloc(sizeof(*winner) + size_needed, GFP_KERNEL))) {
 			debug_printk(1, "created a '%zd' byte cmdq entry at '%p'\n", size_needed, winner);
 			winner->cmdspace = size_needed;
@@ -362,6 +379,8 @@
 	} else if (smallest_seen) {
 		/* we can't allocate new entries, but we have a
 		   too-small entry we can free and replace */
+		if (debug)
+			dump_cmdq(wc);
 		list_del(&smallest_seen->list);
 		kfree(smallest_seen);
 		if ((winner = kmalloc(sizeof(*winner) + size_needed, GFP_KERNEL))) {
@@ -759,7 +778,7 @@
 	if (debug_packets) {
 		debug_printk(1, "RX: ");
 		for (i = 0; i < debug_packets; i++)
-			printk("%02X", readchunk[i]);
+			printk("%02X ", readchunk[i]);
 		printk("\n");
 	}
 



More information about the zaptel-commits mailing list