[svn-commits] rmeyerriecks: linux/trunk r8998 - in /linux/trunk: drivers/dahdi/ drivers/dah...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Jul 26 15:15:00 CDT 2010


Author: rmeyerriecks
Date: Mon Jul 26 15:14:49 2010
New Revision: 8998

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=8998
Log:
Added card level event handler

When a loss of syncronization signal occurs on one of
the spans, it affects all spans on that card. Since we
do not have a span or card level event system, we have
to queue up a global event on all channels for that card

The new event is DAHDI_EVENT_SYNC

Modified:
    linux/trunk/drivers/dahdi/dahdi-base.c
    linux/trunk/drivers/dahdi/wct4xxp/base.c
    linux/trunk/include/dahdi/user.h

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=8998&r1=8997&r2=8998
==============================================================================
--- linux/trunk/drivers/dahdi/dahdi-base.c (original)
+++ linux/trunk/drivers/dahdi/dahdi-base.c Mon Jul 26 15:14:49 2010
@@ -3483,7 +3483,6 @@
 	int x;
 
 	span->alarms &= ~DAHDI_ALARM_LOOPBACK;
-	span->alarms &= ~DAHDI_ALARM_SYNC;
 	/* Determine maint status */
 	if (span->maintstat || span->mainttimer)
 		span->alarms |= DAHDI_ALARM_LOOPBACK;
@@ -3499,27 +3498,43 @@
 		for (x=1; x<maxspans; x++) {
 			if (spans[x] && !spans[x]->alarms && (spans[x]->flags & DAHDI_FLAG_RUNNING)) {
 				if (master != spans[x]) {
-					module_printk(KERN_NOTICE, "Master changed to %s\n", spans[x]->name);
-					span->alarms |= DAHDI_ALARM_SYNC;
+					module_printk(KERN_NOTICE,
+						"Master changed to %s\n",
+						spans[x]->name);
 				}
 				master = spans[x];
 				break;
 			}
 		}
 
-		/* XXX: Remove - Report more detailed alarms */
-		if (span->alarms & DAHDI_ALARM_LOS)
-			module_printk(KERN_NOTICE, "Span %d: Loss of signal\n", span->spanno);
-		if (span->alarms & DAHDI_ALARM_LFA)
-			module_printk(KERN_NOTICE, "Span %d: Loss of Frame Alignment\n", span->spanno);
-		if (span->alarms & DAHDI_ALARM_LMFA)
-			module_printk(KERN_NOTICE, "Span %d: Loss of Multi-Frame Alignment\n", span->spanno);
-		if (span->alarms & DAHDI_ALARM_XLS)
-			module_printk(KERN_NOTICE, "Span %d: Transmit Line Short\n", span->spanno);
-		if (span->alarms & DAHDI_ALARM_XLO)
-			module_printk(KERN_NOTICE, "Span %d: Transmit Line Open\n", span->spanno);
-		if (span->alarms & DAHDI_ALARM_SYNC)
-			module_printk(KERN_NOTICE, "Span %d: Change of syncronization signal\n", span->spanno);
+		/* Report more detailed alarms */
+		if (debug) {
+			if (span->alarms & DAHDI_ALARM_LOS) {
+				module_printk(KERN_NOTICE,
+					"Span %d: Loss of signal\n",
+					span->spanno);
+			}
+			if (span->alarms & DAHDI_ALARM_LFA) {
+				module_printk(KERN_NOTICE,
+					"Span %d: Loss of Frame Alignment\n",
+					span->spanno);
+			}
+			if (span->alarms & DAHDI_ALARM_LMFA) {
+				module_printk(KERN_NOTICE,
+					"Span %d: Loss of Multi-Frame "\
+					"Alignment\n", span->spanno);
+			}
+			if (span->alarms & DAHDI_ALARM_XLS) {
+				module_printk(KERN_NOTICE,
+					"Span %d: Transmit Line Short\n",
+					span->spanno);
+			}
+			if (span->alarms & DAHDI_ALARM_XLO) {
+				module_printk(KERN_NOTICE,
+					"Span %d: Transmit Line Open\n",
+					span->spanno);
+			}
+		}
 	}
 }
 

Modified: linux/trunk/drivers/dahdi/wct4xxp/base.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/wct4xxp/base.c?view=diff&rev=8998&r1=8997&r2=8998
==============================================================================
--- linux/trunk/drivers/dahdi/wct4xxp/base.c (original)
+++ linux/trunk/drivers/dahdi/wct4xxp/base.c Mon Jul 26 15:14:49 2010
@@ -426,6 +426,7 @@
 static void t4_tsi_unassign(struct t4 *wc, int tospan, int tochan);
 static void __t4_set_rclk_src(struct t4 *wc, int span);
 static void __t4_set_sclk_src(struct t4 *wc, int mode, int master, int slave);
+static void t4_card_event(struct t4 *wc, int event);
 static void t4_check_alarms(struct t4 *wc, int span);
 static void t4_check_sigbits(struct t4 *wc, int span);
 
@@ -1554,23 +1555,29 @@
 			t4_reset_counters(span);
 			break;
 		case DAHDI_MAINT_ALARM_SIM:
-//			dev_info(&wc->dev->dev, "Invoking alarm state\n");
 			reg = t4_framer_in(wc, span->offset, FMR0);
-			//dev_info(&wc->dev->dev, "FMR0: %X\n", reg);
-
-			// The alarm simulation state machine requires us to bring this bit
-			// up and down for at least 1 clock cycle
-			// lock register writes to ensure nobody else tries to write to FMR0, while we delay
-			spin_lock_irqsave(&wc->reglock, flags);	
-			__t4_framer_out(wc, span->offset, FMR0, (reg|FMR0_SIM));
+
+			/*
+			 * The alarm simulation state machine requires us to
+			 * bring this bit up and down for at least 1 clock cycle
+			 * lock register writes to ensure nobody else tries to
+			 * write to FMR0, while we delay
+			 */
+			spin_lock_irqsave(&wc->reglock, flags);
+			__t4_framer_out(wc, span->offset,
+					FMR0, (reg | FMR0_SIM));
 			udelay(1);
-			__t4_framer_out(wc, span->offset, FMR0, (reg&~FMR0_SIM));
+			__t4_framer_out(wc, span->offset,
+					FMR0, (reg & ~FMR0_SIM));
 			udelay(1);
 			spin_unlock_irqrestore(&wc->reglock, flags);
 
-			//dev_info(&wc->dev->dev, "FMR0: %X\n", reg|FMR0_SIM);
 			reg = t4_framer_in(wc, span->offset, 0x4e);
-			dev_info(&wc->dev->dev, "FRS2(alarm state): %d\n", ((reg&0xe0)>> 5));
+			if (debug & DEBUG_MAIN) {
+				dev_info(&wc->dev->dev,
+					"FRS2(alarm state): %d\n",
+					((reg & 0xe0) >> 5));
+			}
 			break;
 		default:
 			dev_info(&wc->dev->dev, "Unknown T1 maint command:%d\n",
@@ -2067,6 +2074,8 @@
 	cmr1 |= (span << 6);
 	__t4_framer_out(wc, 0, 0x44, cmr1);
 
+	t4_card_event(wc, DAHDI_EVENT_SYNC);
+
 	dev_info(&wc->dev->dev, "RCLK source set to span %d\n", span+1);
 }
 
@@ -2093,6 +2102,32 @@
 		wc->dmactrl &= ~(1 << 29);/* Provide timing from MCLK */
 
 	__t4_pci_out(wc, WC_DMACTRL, wc->dmactrl);
+}
+
+/*
+ * We do not have a per-span or per-card event system. In
+ * order to create a global event, we send that event to
+ * every channel on the card
+ */
+void t4_card_event(struct t4 *wc, int event)
+{
+	unsigned long flags;
+	struct dahdi_span *span;
+	struct dahdi_chan *chan;
+	int x, y;
+
+	/* Loop through every channel on this card and
+	 * set the global event that occured
+	 */
+	for (x = 0; x < wc->numspans; x++) {
+		span = &wc->tspans[x]->span;
+		for (y = 0; y < span->channels; y++) {
+			chan = span->chans[y];
+			spin_lock_irqsave(&chan->lock, flags);
+			dahdi_qevent_nolock(chan, event);
+			spin_unlock_irqrestore(&chan->lock, flags);
+		}
+	}
 }
 
 static inline void __t4_update_timing(struct t4 *wc)
@@ -2967,13 +3002,13 @@
 	/* Add detailed alarm status information to a red alarm state */
 	if (alarms & DAHDI_ALARM_RED) {
 		if (c & FRS0_LOS)
-		         alarms |= DAHDI_ALARM_LOS;
+			alarms |= DAHDI_ALARM_LOS;
 		if (c & FRS0_LFA)
-		         alarms |= DAHDI_ALARM_LFA;
+			alarms |= DAHDI_ALARM_LFA;
 		if (c & FRS0_LMFA)
-		         alarms |= DAHDI_ALARM_LMFA;
+			alarms |= DAHDI_ALARM_LMFA;
 		if (d & FRS1_XLS)
-		         alarms |= DAHDI_ALARM_XLS;
+			alarms |= DAHDI_ALARM_XLS;
 		if (d & FRS1_XLO)
 			alarms |= DAHDI_ALARM_XLO;
 	}
@@ -3188,8 +3223,9 @@
 		/* T1 checks */
 		if (isr2 || (isr3 & 0x08)) {
 			if (debug & DEBUG_MAIN) {
-				printk("card %d span %d: isr2=%x isr3=%x\n",
-						wc->num, span, isr2, isr3);
+				dev_info(&wc->dev->dev,
+					"span %d: isr2=%x isr3=%x\n",
+					span, isr2, isr3);
 			}
 			t4_check_alarms(wc, span);		
 		}

Modified: linux/trunk/include/dahdi/user.h
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/include/dahdi/user.h?view=diff&rev=8998&r1=8997&r2=8998
==============================================================================
--- linux/trunk/include/dahdi/user.h (original)
+++ linux/trunk/include/dahdi/user.h Mon Jul 26 15:14:49 2010
@@ -314,20 +314,19 @@
 #define DAHDI_CONF_PSEUDO_TALKER	0x800		/* pseudo is a talker on the conference */
 
 /* Alarm Condition bits */
-#define DAHDI_ALARM_NONE		0		/* No alarms */
-#define DAHDI_ALARM_RECOVER		(1 << 0)	/* Recovering from alarm */
-#define DAHDI_ALARM_LOOPBACK		(1 << 1)	/* In loopback */
-#define DAHDI_ALARM_YELLOW		(1 << 2)	/* Yellow Alarm */
-#define DAHDI_ALARM_RED			(1 << 3)	/* Red Alarm */
-#define DAHDI_ALARM_BLUE		(1 << 4)	/* Blue Alarm */
-#define DAHDI_ALARM_NOTOPEN		(1 << 5)	
+#define DAHDI_ALARM_NONE		0	 /* No alarms */
+#define DAHDI_ALARM_RECOVER		(1 << 0) /* Recovering from alarm */
+#define DAHDI_ALARM_LOOPBACK		(1 << 1) /* In loopback */
+#define DAHDI_ALARM_YELLOW		(1 << 2) /* Yellow Alarm */
+#define DAHDI_ALARM_RED			(1 << 3) /* Red Alarm */
+#define DAHDI_ALARM_BLUE		(1 << 4) /* Blue Alarm */
+#define DAHDI_ALARM_NOTOPEN		(1 << 5)
 /* Verbose alarm states (upper byte) */
-#define DAHDI_ALARM_LOS			(1 << 8)	/* Loss of Signal */
-#define DAHDI_ALARM_LFA			(1 << 9)	/* Loss of Frame Alignment */
-#define DAHDI_ALARM_LMFA		(1 << 10)	/* Loss of Multi-Frame Alignment */
-#define DAHDI_ALARM_XLS			(1 << 11)	/* Transmit line Short */
-#define DAHDI_ALARM_XLO			(1 << 12)	/* Transmit line Open */
-#define DAHDI_ALARM_SYNC		(1 << 13)	/* Loss of Sync source */
+#define DAHDI_ALARM_LOS			(1 << 8) /* Loss of Signal */
+#define DAHDI_ALARM_LFA			(1 << 9) /* Loss of Frame Alignment */
+#define DAHDI_ALARM_LMFA		(1 << 10)/* Loss of Multi-Frame Align */
+#define DAHDI_ALARM_XLS			(1 << 11)/* Transmit line Short */
+#define DAHDI_ALARM_XLO			(1 << 12)/* Transmit line Open */
 
 /* Maintenance modes */
 #define DAHDI_MAINT_NONE		0	/* Normal Mode */
@@ -453,6 +452,9 @@
 #define DAHDI_EVENT_PULSEDIGIT		(1 << 16)	/* This is OR'd with the digit received */
 #define DAHDI_EVENT_DTMFDOWN		(1 << 17)	/* Ditto for DTMF key down event */
 #define DAHDI_EVENT_DTMFUP		(1 << 18)	/* Ditto for DTMF key up event */
+
+/* If the source of timing changes */
+#define DAHDI_EVENT_SYNC		29
 
 /* Transcoder related definitions */
 




More information about the svn-commits mailing list