[svn-commits] rmeyerriecks: linux/trunk r8997 - in /linux/trunk: drivers/dahdi/ drivers/dah...
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Mon Jul 26 15:14:59 CDT 2010
Author: rmeyerriecks
Date: Mon Jul 26 15:14:48 2010
New Revision: 8997
URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=8997
Log:
Added the ability to trigger alarm simulation states in the
qfalc framer.
Added some more verbose red alarm states in the upper byte
of the alarm member of the dahdi_span structure
Removed some unnecessary instrumentation regarding the enabling
of the errored second and 1 second counters for performance
collecting. Also added a couple comments.
Modified:
linux/trunk/drivers/dahdi/dahdi-base.c
linux/trunk/drivers/dahdi/wct4xxp/base.c
linux/trunk/drivers/dahdi/wct4xxp/wct4xxp.h
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=8997&r1=8996&r2=8997
==============================================================================
--- linux/trunk/drivers/dahdi/dahdi-base.c (original)
+++ linux/trunk/drivers/dahdi/dahdi-base.c Mon Jul 26 15:14:48 2010
@@ -3483,6 +3483,7 @@
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;
@@ -3497,12 +3498,28 @@
/* Switch to other master if current master in alarm */
for (x=1; x<maxspans; x++) {
if (spans[x] && !spans[x]->alarms && (spans[x]->flags & DAHDI_FLAG_RUNNING)) {
- if(master != spans[x])
+ if (master != spans[x]) {
module_printk(KERN_NOTICE, "Master changed to %s\n", spans[x]->name);
+ span->alarms |= DAHDI_ALARM_SYNC;
+ }
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);
}
}
@@ -4552,6 +4569,7 @@
case DAHDI_MAINT_BIPOLAR_DEFECT:
case DAHDI_MAINT_PRBS:
case DAHDI_RESET_COUNTERS:
+ case DAHDI_MAINT_ALARM_SIM:
/* Prevent notifying an alarm state for generic
maintenance functions, unless the driver is
already in a maint state */
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=8997&r1=8996&r2=8997
==============================================================================
--- linux/trunk/drivers/dahdi/wct4xxp/base.c (original)
+++ linux/trunk/drivers/dahdi/wct4xxp/base.c Mon Jul 26 15:14:48 2010
@@ -462,6 +462,8 @@
#define LIM1_T 0x37 /* Line interface mode 1 register */
#define LIM1_RL (1 << 1) /* Remote Loop */
+#define FMR0 0x1C /* Framer Mode Register 0 */
+#define FMR0_SIM (1 << 0) /* Alarm Simulation */
#define FMR1_T 0x1D /* Framer Mode Register 1 */
#define FMR1_ECM (1 << 2) /* Error Counter 1sec Interrupt Enable */
#define DEC_T 0x60 /* Diable Error Counter */
@@ -1437,6 +1439,7 @@
struct t4_span *ts = container_of(span, struct t4_span, span);
struct t4 *wc = ts->owner;
unsigned int reg;
+ unsigned long flags;
if (ts->spantype == TYPE_E1) {
switch(cmd) {
@@ -1458,6 +1461,11 @@
dev_info(&wc->dev->dev,
"Only local loop supported in E1 mode\n");
return -ENOSYS;
+ case DAHDI_MAINT_ALARM_SIM:
+ dev_info(&wc->dev->dev, "Invoking alarm state");
+ reg = t4_framer_in(wc, span->offset, FMR0);
+ t4_framer_out(wc, span->offset, FMR0, (reg|FMR0_SIM));
+ break;
default:
dev_info(&wc->dev->dev,
"Unknown E1 maint command: %d\n", cmd);
@@ -1545,6 +1553,25 @@
case DAHDI_RESET_COUNTERS:
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));
+ udelay(1);
+ __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));
+ break;
default:
dev_info(&wc->dev->dev, "Unknown T1 maint command:%d\n",
cmd);
@@ -1952,12 +1979,9 @@
/* Enable 1sec timer interrupt */
reg = t4_framer_in(wc, x, FMR1_T);
t4_framer_out(wc, x, FMR1_T, (reg | FMR1_ECM));
- dev_info(&wc->dev->dev, "Enabled 1sec error counter "\
- "interrupt\n");
/* Enable Errored Second interrupt */
t4_framer_out(wc, x, ESM, 0);
- dev_info(&wc->dev->dev, "Enabled errored second interrupt\n");
t4_reset_counters(&ts->span);
@@ -2883,6 +2907,7 @@
alarms |= DAHDI_ALARM_NOTOPEN;
}
+ /* Loss of Frame Alignment */
if (c & 0x20) {
if (ts->alarmcount >= alarmdebounce) {
@@ -2903,7 +2928,8 @@
} else
ts->alarmcount = 0;
- if (c & 0x80) { /* LOS */
+ /* Loss of Signal */
+ if (c & 0x80) {
if (ts->losalarmcount >= losalarmdebounce) {
/* Disable Slip Interrupts */
e = __t4_framer_in(wc, span, 0x17);
@@ -2922,7 +2948,8 @@
} else
ts->losalarmcount = 0;
- if (c & 0x40) { /* AIS */
+ /* Alarm Indication Signal */
+ if (c & 0x40) {
if (ts->aisalarmcount >= aisalarmdebounce)
alarms |= DAHDI_ALARM_BLUE;
else {
@@ -2937,6 +2964,19 @@
} else
ts->aisalarmcount = 0;
+ /* Add detailed alarm status information to a red alarm state */
+ if (alarms & DAHDI_ALARM_RED) {
+ if (c & FRS0_LOS)
+ alarms |= DAHDI_ALARM_LOS;
+ if (c & FRS0_LFA)
+ alarms |= DAHDI_ALARM_LFA;
+ if (c & FRS0_LMFA)
+ alarms |= DAHDI_ALARM_LMFA;
+ if (d & FRS1_XLS)
+ alarms |= DAHDI_ALARM_XLS;
+ if (d & FRS1_XLO)
+ alarms |= DAHDI_ALARM_XLO;
+ }
if (((!ts->span.alarms) && alarms) ||
(ts->span.alarms && (!alarms)))
@@ -3112,6 +3152,7 @@
gis, isr0, isr1, isr2, isr3, isr4, wc->intcount);
}
+ /* Collect performance counters once per second */
if (isr3 & ISR3_SEC) {
ts->span.count.fe += t4_framer_in(wc, span, FECL_T);
ts->span.count.crc4 += t4_framer_in(wc, span, CEC1L_T);
@@ -3121,6 +3162,7 @@
ts->span.count.prbs = t4_framer_in(wc, span, FRS1_T);
}
+ /* Collect errored second counter once per second */
if (isr3 & ISR3_ES) {
ts->span.count.errsec += 1;
}
@@ -3145,7 +3187,10 @@
} else {
/* T1 checks */
if (isr2 || (isr3 & 0x08)) {
- printk("card %d span %d: isr2=%x isr3=%x\n", wc->num, span, isr2, isr3);
+ if (debug & DEBUG_MAIN) {
+ printk("card %d span %d: isr2=%x isr3=%x\n",
+ wc->num, span, isr2, isr3);
+ }
t4_check_alarms(wc, span);
}
}
Modified: linux/trunk/drivers/dahdi/wct4xxp/wct4xxp.h
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/wct4xxp/wct4xxp.h?view=diff&rev=8997&r1=8996&r2=8997
==============================================================================
--- linux/trunk/drivers/dahdi/wct4xxp/wct4xxp.h (original)
+++ linux/trunk/drivers/dahdi/wct4xxp/wct4xxp.h Mon Jul 26 15:14:48 2010
@@ -96,6 +96,15 @@
#define FRMR_SIS_XFW 0x40
#define FRMR_TXFIFO 0x00
+#define FRS0 0x4c
+#define FRS0_LOS (1<<7)
+#define FRS0_LFA (1<<5)
+#define FRS0_LMFA (1<<1)
+
+#define FRS1 0x4d
+#define FRS1_XLS (1<<1)
+#define FRS1_XLO (1<<0)
+
#define NUM_REGS 0xa9
#define NUM_PCI 12
Modified: linux/trunk/include/dahdi/user.h
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/include/dahdi/user.h?view=diff&rev=8997&r1=8996&r2=8997
==============================================================================
--- linux/trunk/include/dahdi/user.h (original)
+++ linux/trunk/include/dahdi/user.h Mon Jul 26 15:14:48 2010
@@ -314,13 +314,20 @@
#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 /* Recovering from alarm */
-#define DAHDI_ALARM_LOOPBACK 2 /* In loopback */
-#define DAHDI_ALARM_YELLOW 4 /* Yellow Alarm */
-#define DAHDI_ALARM_RED 8 /* Red Alarm */
-#define DAHDI_ALARM_BLUE 16 /* Blue Alarm */
-#define DAHDI_ALARM_NOTOPEN 32
+#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 */
/* Maintenance modes */
#define DAHDI_MAINT_NONE 0 /* Normal Mode */
@@ -338,7 +345,8 @@
#define DAHDI_MAINT_BIPOLAR_DEFECT 11 /* insert a FAS defect */
#define DAHDI_MAINT_PRBS 12 /* enable the PRBS gen/mon */
#define DAHDI_MAINT_NETWORKPAYLOADLOOP 13 /* Remote Loopback */
-#define DAHDI_RESET_COUNTERS 14 /* clear the error counters */
+#define DAHDI_RESET_COUNTERS 14 /* Clear the error counters */
+#define DAHDI_MAINT_ALARM_SIM 15 /* Simulate alarms */
/* Flag Value for IOMUX, read avail */
#define DAHDI_IOMUX_READ 1
More information about the svn-commits
mailing list