[svn-commits] dbailey: linux/trunk r6941 - in /linux/trunk/drivers/dahdi: ./ wctdm24xxp/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Aug 5 09:40:51 CDT 2009


Author: dbailey
Date: Wed Aug  5 09:40:45 2009
New Revision: 6941

URL: http://svn.asterisk.org/svn-view/dahdi?view=rev&rev=6941
Log:
Change proslic linefeed register setting

Insure that proslic linefeed register is not transitioned from Active to
On-Hook Transmission while the channel is off-hook.
Replaced magic numbers assigned to linefeed associated variables with more
descriptive constants. 

(issue #15352)
Reported by: alecdavis
Patches:
      wctdm_prevent_ohttimer_click.diff3.txt uploaded by dbailey (license 819)
Tested by: alecdavis, dbailey, vmikhelson


Modified:
    linux/trunk/drivers/dahdi/proslic.h
    linux/trunk/drivers/dahdi/wctdm.c
    linux/trunk/drivers/dahdi/wctdm24xxp/base.c

Modified: linux/trunk/drivers/dahdi/proslic.h
URL: http://svn.asterisk.org/svn-view/dahdi/linux/trunk/drivers/dahdi/proslic.h?view=diff&rev=6941&r1=6940&r2=6941
==============================================================================
--- linux/trunk/drivers/dahdi/proslic.h (original)
+++ linux/trunk/drivers/dahdi/proslic.h Wed Aug  5 09:40:45 2009
@@ -34,6 +34,19 @@
 
 // Defines
 #define LPT 0X378
+
+/* Proslic Linefeed options for register 64 - Linefeed Control */
+#define SLIC_LF_OPEN		0x0
+#define SLIC_LF_ACTIVE_FWD	0x1
+#define SLIC_LF_OHTRAN_FWD	0x2
+#define SLIC_LF_TIP_OPEN	0x3
+#define SLIC_LF_RINGING		0x4
+#define SLIC_LF_ACTIVE_REV	0x5
+#define SLIC_LF_OHTRAN_REV	0x6
+#define SLIC_LF_RING_OPEN	0x7
+
+/* Mask used to reverse the linefeed mode between forward and reverse polarity */
+#define SLIC_LF_REVMASK 	0x4
 
 #define IDA_LO  28
 #define IDA_HI	29

Modified: linux/trunk/drivers/dahdi/wctdm.c
URL: http://svn.asterisk.org/svn-view/dahdi/linux/trunk/drivers/dahdi/wctdm.c?view=diff&rev=6941&r1=6940&r2=6941
==============================================================================
--- linux/trunk/drivers/dahdi/wctdm.c (original)
+++ linux/trunk/drivers/dahdi/wctdm.c Wed Aug  5 09:40:45 2009
@@ -737,8 +737,8 @@
 		} else {
 			if (wc->mod[card].fxs.palarms++ < MAX_ALARMS) {
 				printk(KERN_NOTICE "Power alarm on module %d, resetting!\n", card + 1);
-				if (wc->mod[card].fxs.lasttxhook == 4)
-					wc->mod[card].fxs.lasttxhook = 1;
+				if (wc->mod[card].fxs.lasttxhook == SLIC_LF_RINGING)
+					wc->mod[card].fxs.lasttxhook = SLIC_LF_ACTIVE_FWD;
 				wctdm_setreg(wc, card, 64, wc->mod[card].fxs.lasttxhook);
 			} else {
 				if (wc->mod[card].fxs.palarms == MAX_ALARMS)
@@ -997,6 +997,16 @@
 				if (debug)
 #endif				
 					printk(KERN_DEBUG "wctdm: Card %d Going off hook\n", card);
+
+				switch ( wc->mod[card].fxs.lasttxhook ) {
+				case SLIC_LF_RINGING:      /* Ringing */
+				case SLIC_LF_OHTRAN_FWD:      /* Forward On Hook Transfer */
+				case SLIC_LF_OHTRAN_REV:      /* Reverse On Hook Transfer */
+					/* just detected OffHook, during Ringing or OnHookTransfer */
+					wc->mod[card].fxs.idletxhookstate = POLARITY_XOR(card) ? SLIC_LF_ACTIVE_REV : SLIC_LF_ACTIVE_FWD;	/* Active */
+					break;
+				}
+
 				dahdi_hooksig(wc->chans[card], DAHDI_RXSIG_OFFHOOK);
 				if (robust)
 					wctdm_init_proslic(wc, card, 1, 0, 1);
@@ -1045,7 +1055,7 @@
 	for (x=0;x<4;x++) {
 		if (wc->cardflag & (1 << x) &&
 		    (wc->modtype[x] == MOD_TYPE_FXS)) {
-			if (wc->mod[x].fxs.lasttxhook == 0x4) {
+			if (wc->mod[x].fxs.lasttxhook == SLIC_LF_RINGING) {
 				/* RINGing, prepare for OHT */
 				wc->mod[x].fxs.ohttimer = OHT_TIMER << 3;
 
@@ -1054,15 +1064,15 @@
 				    ioctl channel variable fxs 'reversepolarity', Line Reversal Alert Signal if required.
 				    ioctl channel variable fxs 'vmwi_lrev', VMWI pending.
 				 */
-				wc->mod[x].fxs.idletxhookstate = POLARITY_XOR(x) ? 0x6 : 0x2;/* OHT mode when idle */
+				wc->mod[x].fxs.idletxhookstate = POLARITY_XOR(x) ? SLIC_LF_OHTRAN_REV : SLIC_LF_OHTRAN_FWD;/* OHT mode when idle */
 			} else {
 				if (wc->mod[x].fxs.ohttimer) {
 					wc->mod[x].fxs.ohttimer-= DAHDI_CHUNKSIZE;
 					if (!wc->mod[x].fxs.ohttimer) {
-						wc->mod[x].fxs.idletxhookstate = POLARITY_XOR(x) ? 0x5 : 0x1; /* Switch to Active : Reverse Forward */
-						if ((wc->mod[x].fxs.lasttxhook == 0x2) || (wc->mod[x].fxs.lasttxhook == 0x6)) {
+						wc->mod[x].fxs.idletxhookstate = POLARITY_XOR(x) ? SLIC_LF_ACTIVE_REV : SLIC_LF_ACTIVE_FWD; /* Switch to Active : Reverse Forward */
+						if ((wc->mod[x].fxs.lasttxhook == SLIC_LF_OHTRAN_FWD) || (wc->mod[x].fxs.lasttxhook == SLIC_LF_OHTRAN_REV )) {
 							/* Apply the change if appropriate */
-							wc->mod[x].fxs.lasttxhook = POLARITY_XOR(x) ? 0x5 : 0x1;
+							wc->mod[x].fxs.lasttxhook = POLARITY_XOR(x) ? SLIC_LF_ACTIVE_REV : SLIC_LF_ACTIVE_FWD;
 							wctdm_setreg(wc, x, 64, wc->mod[x].fxs.lasttxhook);
 						}
 					}
@@ -1473,21 +1483,21 @@
 			  );
 	}
 	if (POLARITY_XOR(chan_idx)) {
-		wc->mod[chan_idx].fxs.idletxhookstate |= 0x4;
+		wc->mod[chan_idx].fxs.idletxhookstate |= SLIC_LF_REVMASK;
 		/* Do not set while currently ringing or open */
-		if (wc->mod[chan_idx].fxs.lasttxhook != 0x04 &&
-				  wc->mod[chan_idx ].fxs.lasttxhook != 0x00) {
-			wc->mod[chan_idx ].fxs.lasttxhook |= 0x4;
+		if (wc->mod[chan_idx].fxs.lasttxhook != SLIC_LF_RINGING &&
+				  wc->mod[chan_idx ].fxs.lasttxhook != SLIC_LF_OPEN) {
+			wc->mod[chan_idx ].fxs.lasttxhook |= SLIC_LF_REVMASK;
 			wctdm_setreg(wc, chan_idx, 64, wc->mod[chan_idx].fxs.lasttxhook);
-				  }
+		}
 	} else {
-		wc->mod[chan_idx].fxs.idletxhookstate &= ~0x04;
+		wc->mod[chan_idx].fxs.idletxhookstate &= ~SLIC_LF_REVMASK;
 		/* Do not set while currently ringing or open */
-		if (wc->mod[chan_idx].fxs.lasttxhook != 0x04 &&
-				  wc->mod[chan_idx].fxs.lasttxhook != 0x00) {
-			wc->mod[chan_idx].fxs.lasttxhook &= ~0x04;
+		if (wc->mod[chan_idx].fxs.lasttxhook != SLIC_LF_RINGING &&
+				  wc->mod[chan_idx].fxs.lasttxhook != SLIC_LF_OPEN) {
+			wc->mod[chan_idx].fxs.lasttxhook &= ~SLIC_LF_REVMASK;
 			wctdm_setreg(wc, chan_idx, 64, wc->mod[chan_idx].fxs.lasttxhook);
-				  }
+		}
 	}
 	return 0;
 }
@@ -1618,9 +1628,9 @@
 				
 	/* By default, don't send on hook */
 	if (!reversepolarity != !wc->mod[card].fxs.reversepolarity)
-		wc->mod[card].fxs.idletxhookstate = 5;
+		wc->mod[card].fxs.idletxhookstate = SLIC_LF_ACTIVE_REV;
 	else
-		wc->mod[card].fxs.idletxhookstate = 1;
+		wc->mod[card].fxs.idletxhookstate = SLIC_LF_ACTIVE_FWD;
 
 	if (sane) {
 		/* Make sure we turn off the DC->DC converter to prevent anything from blowing up */
@@ -1857,10 +1867,10 @@
 		if (get_user(x, (__user int *) data))
 			return -EFAULT;
 		wc->mod[chan->chanpos - 1].fxs.ohttimer = x << 3;
-		wc->mod[chan->chanpos - 1].fxs.idletxhookstate = POLARITY_XOR(chan->chanpos - 1) ? 0x6 : 0x2;	/* OHT mode when idle */
-		if (wc->mod[chan->chanpos - 1].fxs.lasttxhook == 0x1 || wc->mod[chan->chanpos - 1].fxs.lasttxhook == 0x5) {
+		wc->mod[chan->chanpos - 1].fxs.idletxhookstate = POLARITY_XOR(chan->chanpos - 1) ? SLIC_LF_ACTIVE_REV : SLIC_LF_ACTIVE_FWD;	/* Active mode when idle */
+		if (wc->mod[chan->chanpos - 1].fxs.lasttxhook == SLIC_LF_ACTIVE_FWD || wc->mod[chan->chanpos - 1].fxs.lasttxhook == SLIC_LF_ACTIVE_REV) {
 			/* Apply the change if appropriate */
-			wc->mod[chan->chanpos - 1].fxs.lasttxhook = POLARITY_XOR(chan->chanpos - 1) ? 0x6 : 0x2;
+			wc->mod[chan->chanpos - 1].fxs.lasttxhook = POLARITY_XOR(chan->chanpos - 1) ? SLIC_LF_OHTRAN_REV : SLIC_LF_OHTRAN_FWD;
 			wctdm_setreg(wc, chan->chanpos - 1, 64, wc->mod[chan->chanpos - 1].fxs.lasttxhook);
 		}
 		break;
@@ -1870,15 +1880,15 @@
 		if (wc->modtype[chan->chanpos - 1] != MOD_TYPE_FXS)
 			return -EINVAL;
 		/* Can't change polarity while ringing or when open */
-		if ((wc->mod[chan->chanpos -1 ].fxs.lasttxhook == 0x04) ||
-		    (wc->mod[chan->chanpos -1 ].fxs.lasttxhook == 0x00))
+		if ((wc->mod[chan->chanpos -1 ].fxs.lasttxhook == SLIC_LF_RINGING) ||
+		    (wc->mod[chan->chanpos -1 ].fxs.lasttxhook == SLIC_LF_OPEN))
 			return -EINVAL;
 		
 		wc->mod[chan->chanpos - 1].fxs.reversepolarity = x;
 		if ( POLARITY_XOR(chan->chanpos - 1) )
-			wc->mod[chan->chanpos - 1].fxs.lasttxhook |= 0x04;
+			wc->mod[chan->chanpos - 1].fxs.lasttxhook |= SLIC_LF_REVMASK;
 		else
-			wc->mod[chan->chanpos - 1].fxs.lasttxhook &= ~0x04;
+			wc->mod[chan->chanpos - 1].fxs.lasttxhook &= ~SLIC_LF_REVMASK;
 		wctdm_setreg(wc, chan->chanpos - 1, 64, wc->mod[chan->chanpos - 1].fxs.lasttxhook);
 		break;
 	case DAHDI_VMWI_CONFIG:
@@ -2007,7 +2017,7 @@
 	struct wctdm *wc = chan->pvt;
 	wc->usecount--;
 	if (wc->modtype[chan->chanpos - 1] == MOD_TYPE_FXS) {
-		wc->mod[chan->chanpos - 1].fxs.idletxhookstate = POLARITY_XOR(chan->chanpos - 1) ? 0x5 : 0x1;
+		wc->mod[chan->chanpos - 1].fxs.idletxhookstate = POLARITY_XOR(chan->chanpos - 1) ? SLIC_LF_ACTIVE_REV : SLIC_LF_ACTIVE_FWD;
 	}
 	/* If we're dead, release us now */
 	if (!wc->usecount && wc->dead) 
@@ -2040,20 +2050,20 @@
 			switch(chan->sig) {
 			case DAHDI_SIG_FXOKS:
 			case DAHDI_SIG_FXOLS:
-				wc->mod[chan->chanpos-1].fxs.lasttxhook = (wc->mod[chan->chanpos-1].fxs.vmwi_hvac ? 4 : wc->mod[chan->chanpos-1].fxs.idletxhookstate);
+				wc->mod[chan->chanpos-1].fxs.lasttxhook = (wc->mod[chan->chanpos-1].fxs.vmwi_hvac ? SLIC_LF_RINGING : wc->mod[chan->chanpos-1].fxs.idletxhookstate);
 				break;
 			case DAHDI_SIG_EM:
 				wc->mod[chan->chanpos-1].fxs.lasttxhook = wc->mod[chan->chanpos-1].fxs.idletxhookstate;
 				break;
 			case DAHDI_SIG_FXOGS:
-				wc->mod[chan->chanpos-1].fxs.lasttxhook = 3;
+				wc->mod[chan->chanpos-1].fxs.lasttxhook = SLIC_LF_TIP_OPEN;
 				break;
 			}
 			break;
 		case DAHDI_TXSIG_OFFHOOK:
 			switch(chan->sig) {
 			case DAHDI_SIG_EM:
-				wc->mod[chan->chanpos-1].fxs.lasttxhook = 5;
+				wc->mod[chan->chanpos-1].fxs.lasttxhook = SLIC_LF_ACTIVE_REV;
 				break;
 			default:
 				wc->mod[chan->chanpos-1].fxs.lasttxhook = wc->mod[chan->chanpos-1].fxs.idletxhookstate;
@@ -2061,10 +2071,10 @@
 			}
 			break;
 		case DAHDI_TXSIG_START:
-			wc->mod[chan->chanpos-1].fxs.lasttxhook = 4;
+			wc->mod[chan->chanpos-1].fxs.lasttxhook = SLIC_LF_RINGING;
 			break;
 		case DAHDI_TXSIG_KEWL:
-			wc->mod[chan->chanpos-1].fxs.lasttxhook = 0;
+			wc->mod[chan->chanpos-1].fxs.lasttxhook = SLIC_LF_OPEN;
 			break;
 		default:
 			printk(KERN_NOTICE "wctdm: Can't set tx state to %d\n", txsig);

Modified: linux/trunk/drivers/dahdi/wctdm24xxp/base.c
URL: http://svn.asterisk.org/svn-view/dahdi/linux/trunk/drivers/dahdi/wctdm24xxp/base.c?view=diff&rev=6941&r1=6940&r2=6941
==============================================================================
--- linux/trunk/drivers/dahdi/wctdm24xxp/base.c (original)
+++ linux/trunk/drivers/dahdi/wctdm24xxp/base.c Wed Aug  5 09:40:45 2009
@@ -1193,8 +1193,8 @@
 		wc->mods[card].fxs.palarms++;
 		if (wc->mods[card].fxs.palarms < MAX_ALARMS) {
 			printk(KERN_NOTICE "Power alarm (%02x) on module %d, resetting!\n", res, card + 1);
-			if (wc->mods[card].fxs.lasttxhook == 4) {
-				wc->mods[card].fxs.lasttxhook = POLARITY_XOR(card) ? 0x15 : 0x11;
+			if (wc->mods[card].fxs.lasttxhook == SLIC_LF_RINGING) {
+				wc->mods[card].fxs.lasttxhook = 0x10 | POLARITY_XOR(card) ? SLIC_LF_ACTIVE_REV : SLIC_LF_ACTIVE_FWD;
 			}
 			wc->sethook[card] = CMD_WR(19, res);
 #if 0
@@ -1223,8 +1223,8 @@
 		wc->mods[card].fxs.palarms++;
 		if (wc->mods[card].fxs.palarms < MAX_ALARMS) {
 			printk(KERN_NOTICE "Power alarm on module %d, resetting!\n", card + 1);
-			if (wc->mods[card].fxs.lasttxhook == 4) {
-				wc->mods[card].fxs.lasttxhook = POLARITY_XOR(card) ? 0x15 : 0x11;;
+			if (wc->mods[card].fxs.lasttxhook == SLIC_LF_RINGING) {
+				wc->mods[card].fxs.lasttxhook = POLARITY_XOR(card) ? SLIC_LF_ACTIVE_REV : SLIC_LF_ACTIVE_FWD;;
 			}
 			wc->mods[card].fxs.lasttxhook |= 0x10;
 			wc->sethook[card] = CMD_WR(64, wc->mods[card].fxs.lasttxhook);
@@ -1597,6 +1597,14 @@
 				/* Off hook */
 				if (debug & DEBUG_CARD)
 					printk(KERN_DEBUG "wctdm: Card %d Going off hook\n", card);
+				switch ( wc->mods[card].fxs.lasttxhook ) {
+					case SLIC_LF_RINGING:      /* Ringing */
+					case SLIC_LF_OHTRAN_FWD:      /* Forward On Hook Transfer */
+					case SLIC_LF_OHTRAN_REV:      /* Reverse On Hook Transfer */
+						/* just detected OffHook, during Ringing or OnHookTransfer */
+						wc->mods[card].fxs.idletxhookstate = POLARITY_XOR(card) ? SLIC_LF_ACTIVE_REV : SLIC_LF_ACTIVE_FWD;	/* Active */
+						break;
+				}
 				dahdi_hooksig(wc->chans[card], DAHDI_RXSIG_OFFHOOK);
 				if (robust)
 					wctdm_init_proslic(wc, card, 1, 0, 1);
@@ -1725,23 +1733,23 @@
 				wctdm_proslic_check_hook(wc, x);
 				if (!(wc->intcount & 0xfc))
 					wctdm_proslic_recheck_sanity(wc, x);
-				if (wc->mods[x].fxs.lasttxhook == 0x4) {
+				if (wc->mods[x].fxs.lasttxhook == SLIC_LF_RINGING) {
 					/* RINGing, prepare for OHT */
 					wc->mods[x].fxs.ohttimer = OHT_TIMER << 3;
-					wc->mods[x].fxs.idletxhookstate = POLARITY_XOR(x) ? 0x6 : 0x2; /* OHT mode when idle */
+					wc->mods[x].fxs.idletxhookstate = POLARITY_XOR(x) ? SLIC_LF_OHTRAN_REV : SLIC_LF_OHTRAN_FWD; /* OHT mode when idle */
 				} else {
 					if (wc->mods[x].fxs.ohttimer) {
 						wc->mods[x].fxs.ohttimer-= DAHDI_CHUNKSIZE;
 						if (!wc->mods[x].fxs.ohttimer) {
-							wc->mods[x].fxs.idletxhookstate = POLARITY_XOR(x) ? 0x5 : 0x1; 	/* Switch to active */ 
-							if (wc->mods[x].fxs.lasttxhook == 0x2) {	
+							wc->mods[x].fxs.idletxhookstate = POLARITY_XOR(x) ? SLIC_LF_ACTIVE_REV : SLIC_LF_ACTIVE_FWD; 	/* Switch to active */
+							if (wc->mods[x].fxs.lasttxhook == SLIC_LF_OHTRAN_FWD) {	
 								/* Apply the change if appropriate */
-								wc->mods[x].fxs.lasttxhook = 0x11;
+								wc->mods[x].fxs.lasttxhook = 0x10 | SLIC_LF_ACTIVE_FWD;
 								wc->sethook[x] = CMD_WR(64, wc->mods[x].fxs.lasttxhook);	/* Data enqueued here */  
 								/* wctdm_setreg_intr(wc, x, 64, wc->mods[x].fxs.lasttxhook); */
-							} else if (wc->mods[x].fxs.lasttxhook == 0x6) {	
+							} else if (wc->mods[x].fxs.lasttxhook == SLIC_LF_OHTRAN_REV) {
 								/* Apply the change if appropriate */
-								wc->mods[x].fxs.lasttxhook = 0x15;
+								wc->mods[x].fxs.lasttxhook = 0x10 | SLIC_LF_ACTIVE_REV;
 								wc->sethook[x] = CMD_WR(64, wc->mods[x].fxs.lasttxhook);	/* Data enqueued here */  
 								/* wctdm_setreg_intr(wc, x, 64, wc->mods[x].fxs.lasttxhook); */
 							}
@@ -2124,20 +2132,20 @@
 	}
 	/* Set line polarity for new VMWI state */
 	if (POLARITY_XOR(chan_idx)) {
-		wc->mods[chan_idx].fxs.idletxhookstate |= 0x14;
+		wc->mods[chan_idx].fxs.idletxhookstate |= 0x10 | SLIC_LF_REVMASK;
 		/* Do not set while currently ringing or open */
-		if (wc->mods[chan_idx].fxs.lasttxhook != 0x04  &&
-				  wc->mods[chan_idx].fxs.lasttxhook != 0x00) {
-			wc->mods[chan_idx].fxs.lasttxhook |= 0x14;
+		if (wc->mods[chan_idx].fxs.lasttxhook != SLIC_LF_RINGING  &&
+				  wc->mods[chan_idx].fxs.lasttxhook != SLIC_LF_OPEN) {
+			wc->mods[chan_idx].fxs.lasttxhook |= 0x10 | SLIC_LF_REVMASK;
 			wc->sethook[chan_idx] = CMD_WR(64, wc->mods[chan_idx].fxs.lasttxhook);
-				  }
+		}
 	} else {
-		wc->mods[chan_idx].fxs.idletxhookstate &= ~0x04;
+		wc->mods[chan_idx].fxs.idletxhookstate &= ~SLIC_LF_REVMASK;
 		/* Do not set while currently ringing or open */
-		if (wc->mods[chan_idx].fxs.lasttxhook != 0x04 &&
-				  wc->mods[chan_idx].fxs.lasttxhook != 0x00) {
+		if (wc->mods[chan_idx].fxs.lasttxhook != SLIC_LF_RINGING &&
+				  wc->mods[chan_idx].fxs.lasttxhook != SLIC_LF_OPEN) {
 			x = wc->mods[chan_idx].fxs.lasttxhook;
-			x &= ~0x04;
+			x &= ~SLIC_LF_REVMASK;
 			x |= 0x10;
 			wc->mods[chan_idx].fxs.lasttxhook = x;
 			wc->sethook[chan_idx] = CMD_WR(64, wc->mods[chan_idx].fxs.lasttxhook);
@@ -2276,9 +2284,9 @@
 
 	/* By default, don't send on hook */
 	if (!reversepolarity != !wc->mods[card].fxs.reversepolarity) {
-		wc->mods[card].fxs.idletxhookstate = 5;
+		wc->mods[card].fxs.idletxhookstate = SLIC_LF_ACTIVE_REV;
 	} else {
-		wc->mods[card].fxs.idletxhookstate = 1;
+		wc->mods[card].fxs.idletxhookstate = SLIC_LF_ACTIVE_FWD;
 	}
 	wc->mods[card].fxs.lasttxhook = 0x10;
 
@@ -2655,10 +2663,10 @@
 		if (get_user(x, (__user int *) data))
 			return -EFAULT;
 		wc->mods[chan->chanpos - 1].fxs.ohttimer = x << 3;
-		wc->mods[chan->chanpos - 1].fxs.idletxhookstate = 0x2;	/* OHT mode when idle */
-		if (wc->mods[chan->chanpos - 1].fxs.lasttxhook == 0x1 || wc->mods[chan->chanpos - 1].fxs.lasttxhook == 0x5) {
+		wc->mods[chan->chanpos - 1].fxs.idletxhookstate = POLARITY_XOR(chan->chanpos - 1) ? SLIC_LF_ACTIVE_REV : SLIC_LF_ACTIVE_FWD;	/* Active mode when idle */
+		if (wc->mods[chan->chanpos - 1].fxs.lasttxhook == SLIC_LF_ACTIVE_FWD || wc->mods[chan->chanpos - 1].fxs.lasttxhook == SLIC_LF_ACTIVE_REV) {
 			/* Apply the change if appropriate */
-			wc->mods[chan->chanpos - 1].fxs.lasttxhook = POLARITY_XOR(chan->chanpos -1) ? 0x16 : 0x12;
+			wc->mods[chan->chanpos - 1].fxs.lasttxhook = 0x10 | POLARITY_XOR(chan->chanpos -1) ? SLIC_LF_OHTRAN_REV : SLIC_LF_OHTRAN_FWD;
 			wc->sethook[chan->chanpos - 1] = CMD_WR(64, wc->mods[chan->chanpos - 1].fxs.lasttxhook);
 			/* wctdm_setreg(wc, chan->chanpos - 1, 64, wc->mods[chan->chanpos - 1].fxs.lasttxhook); */
 		}
@@ -2777,8 +2785,8 @@
 		if (wc->modtype[chan->chanpos - 1] != MOD_TYPE_FXS)
 			return -EINVAL;
 		/* Can't change polarity while ringing or when open */
-		if ((wc->mods[chan->chanpos -1 ].fxs.lasttxhook == 0x04) ||
-						(wc->mods[chan->chanpos -1 ].fxs.lasttxhook == 0x00))
+		if ((wc->mods[chan->chanpos -1 ].fxs.lasttxhook == SLIC_LF_RINGING) ||
+						(wc->mods[chan->chanpos -1 ].fxs.lasttxhook == SLIC_LF_OPEN))
 			return -EINVAL;
 		if (x) {
 			wc->mods[chan->chanpos -1 ].fxs.reversepolarity = 1;
@@ -2786,12 +2794,12 @@
 			wc->mods[chan->chanpos -1 ].fxs.reversepolarity = 0;
 		}
 		if (POLARITY_XOR(chan->chanpos -1)) {
-			wc->mods[chan->chanpos -1 ].fxs.idletxhookstate |= 0x14;
-			wc->mods[chan->chanpos -1 ].fxs.lasttxhook |= 0x14;
+			wc->mods[chan->chanpos -1 ].fxs.idletxhookstate |= SLIC_LF_REVMASK;
+			wc->mods[chan->chanpos -1 ].fxs.lasttxhook |= 0x10 | SLIC_LF_REVMASK;
 		} else {
-			wc->mods[chan->chanpos -1 ].fxs.idletxhookstate &= ~0x04;
+			wc->mods[chan->chanpos -1 ].fxs.idletxhookstate &= ~SLIC_LF_REVMASK;
 			x = wc->mods[chan->chanpos -1 ].fxs.lasttxhook;
-			x &= ~0x04;
+			x &= ~SLIC_LF_REVMASK;
 			x |= 0x10;
 			wc->mods[chan->chanpos -1 ].fxs.lasttxhook = x;
 		}
@@ -2976,7 +2984,7 @@
 	signed char reg;
 	for (x=0;x<wc->cards;x++) {
 		if (wc->modtype[x] == MOD_TYPE_FXS) {
-			wc->mods[x].fxs.idletxhookstate = POLARITY_XOR(x) ? 5 : 1;
+			wc->mods[x].fxs.idletxhookstate = POLARITY_XOR(x) ? SLIC_LF_ACTIVE_REV : SLIC_LF_ACTIVE_FWD;
 		}
 		if (wc->modtype[x] == MOD_TYPE_QRV)
 		{
@@ -3050,9 +3058,9 @@
 				break;
 			case DAHDI_SIG_FXOGS:
 				if (POLARITY_XOR(chan->chanpos -1)) {
-					wc->mods[chan->chanpos - 1].fxs.lasttxhook = 0x17;
+					wc->mods[chan->chanpos - 1].fxs.lasttxhook = 0x10 | SLIC_LF_RING_OPEN;
 				} else {
-					wc->mods[chan->chanpos - 1].fxs.lasttxhook = 0x13;
+					wc->mods[chan->chanpos - 1].fxs.lasttxhook = 0x10 | SLIC_LF_TIP_OPEN;
 				}
 				break;
 			}
@@ -3061,9 +3069,9 @@
 			switch(chan->sig) {
 			case DAHDI_SIG_EM:
 				if (POLARITY_XOR(chan->chanpos -1)) {
-					wc->mods[chan->chanpos - 1].fxs.lasttxhook = 0x11;
+					wc->mods[chan->chanpos - 1].fxs.lasttxhook = 0x10 | SLIC_LF_ACTIVE_FWD;
 				} else {
-					wc->mods[chan->chanpos - 1].fxs.lasttxhook = 0x15;
+					wc->mods[chan->chanpos - 1].fxs.lasttxhook = 0x10 | SLIC_LF_ACTIVE_REV;
 				}
 				break;
 			default:
@@ -3073,10 +3081,10 @@
 			}
 			break;
 		case DAHDI_TXSIG_START:
-			wc->mods[chan->chanpos - 1].fxs.lasttxhook = 0x14;
+			wc->mods[chan->chanpos - 1].fxs.lasttxhook = 0x10 | SLIC_LF_RINGING;
 			break;
 		case DAHDI_TXSIG_KEWL:
-			wc->mods[chan->chanpos - 1].fxs.lasttxhook = 0x10;
+			wc->mods[chan->chanpos - 1].fxs.lasttxhook = 0x10 | SLIC_LF_OPEN;
 			break;
 		default:
 			printk(KERN_NOTICE "wctdm24xxp: Can't set tx state to %d\n", txsig);




More information about the svn-commits mailing list