[svn-commits] rmeyerriecks: linux/trunk r8564 - in /linux/trunk/drivers/dahdi: ./ wcte12xp/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Apr 23 16:54:34 CDT 2010


Author: rmeyerriecks
Date: Fri Apr 23 16:54:30 2010
New Revision: 8564

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=8564
Log:
dahdi-base: wcte12xp: Fixed Clear/RBS channel mode issue

Fixes DAHDI-449 where chanconfig was failing on the first call. It needed
to be called twice in a row. This was due to the channel configuration using
a non-relative channel number in its loop.

Also re-added the register dumping ioctl for inspecting the framer's state.


Modified:
    linux/trunk/drivers/dahdi/dahdi-base.c
    linux/trunk/drivers/dahdi/wcte12xp/base.c

Modified: linux/trunk/drivers/dahdi/dahdi-base.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/dahdi-base.c?view=diff&rev=8564&r1=8563&r2=8564
==============================================================================
--- linux/trunk/drivers/dahdi/dahdi-base.c (original)
+++ linux/trunk/drivers/dahdi/dahdi-base.c Fri Apr 23 16:54:30 2010
@@ -4288,8 +4288,10 @@
 		}
 
 		if (!res && chans[ch.chan]->span->chanconfig) {
+			spin_unlock_irqrestore(&chans[ch.chan]->lock, flags);
 			res = chans[ch.chan]->span->chanconfig(chans[ch.chan],
 							       ch.sigtype);
+			spin_lock_irqsave(&chans[ch.chan]->lock, flags);
 		}
 
 #ifdef CONFIG_DAHDI_NET

Modified: linux/trunk/drivers/dahdi/wcte12xp/base.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/wcte12xp/base.c?view=diff&rev=8564&r1=8563&r2=8564
==============================================================================
--- linux/trunk/drivers/dahdi/wcte12xp/base.c (original)
+++ linux/trunk/drivers/dahdi/wcte12xp/base.c Fri Apr 23 16:54:30 2010
@@ -662,19 +662,37 @@
 	int ret;
 	unsigned short val=0;
 	
-	for (i = 0; i < 24; i++) {
-		j = (i / 8);
-		if (wc->span.chans[i]->flags & DAHDI_FLAG_CLEAR) 
-			val |= 1 << (7 - (i % 8));
-		if (((i % 8)==7) &&  /* write byte every 8 channels */
-		    ((channo < 0) ||    /* channo=-1 means all channels */ 
-		     (j == (channo-1)/8) )) { /* only the register for this channo */    
-			ret = t1_setreg(wc, 0x2f + j, val);
-			if (ret < 0) {
-				t1_info(wc, "set_clear failed for chan %d!\n",
-					i);
-			}
-			val = 0;
+	if (channo < 0) {
+		/* If channo is passed as -1, we want to set all
+		   24 channels to clear mode */
+		t1_setreg(wc, 0x2f, 0xff);
+		t1_setreg(wc, 0x30, 0xff);
+		t1_setreg(wc, 0x31, 0xff);
+	} else {
+		/* if channo is passed as an existing channel
+		   set that specific channel depending on its flag */
+
+		/* Get register offset and regster's value */
+		j = (channo-1)/8;
+		val = t1_getreg(wc, 0x2f+j);
+
+		for (i = 0; i < 24; i++) {
+			if(wc->span.chans[i]->flags & DAHDI_FLAG_CLEAR)
+				debug |= (1<<i);
+			else
+				debug &= ~(1<<i);
+		}
+
+		/* Clear or set the bit depending on the channo's flag */
+		if (wc->span.chans[channo-1]->flags & DAHDI_FLAG_CLEAR) {
+			val |= 1 << (7 - ((channo-1) % 8));
+		} else {
+			val &= ~(1 << (7 - ((channo-1) % 8)));
+		}
+
+		ret = t1_setreg(wc, 0x2f+j, val);
+		if (ret < 0) {
+			t1_info(wc, "set_clear failed for chan %d!\n", channo);
 		}
 	}
 }
@@ -978,7 +996,7 @@
 	struct t1 *wc = chan->pvt;
 	if (test_bit(DAHDI_FLAGBIT_RUNNING, &chan->span->flags) &&
 		(wc->spantype != TYPE_E1)) {
-		__t1xxp_set_clear(wc, chan->channo);
+		__t1xxp_set_clear(wc, chan->chanpos);
 	}
 	return 0;
 }
@@ -1300,14 +1318,18 @@
 
 static int t1xxp_ioctl(struct dahdi_chan *chan, unsigned int cmd, unsigned long data)
 {
+	struct t4_regs regs;
+	unsigned int x;
+	struct t1 *wc;
+	
 	switch (cmd) {
 	case WCT4_GET_REGS:
-		/* Since all register access was moved into the voicebus
-		 * module....this was removed.  Although...why does the client
-		 * library need access to the registers (debugging)? \todo ..
-		 */
-		WARN_ON(1);
-		return -ENOSYS;
+		wc = chan->pvt;
+		for (x = 0; x < sizeof(regs.regs) / sizeof(regs.regs[0]); x++)
+			regs.regs[x] = t1_getreg(wc, x);
+		
+		if (copy_to_user((struct t4_regs *) data, &regs, sizeof(regs)))
+			return -EFAULT;
 		break;
 	default:
 		return -ENOTTY;




More information about the svn-commits mailing list