[svn-commits] tzafrir: branch 1.2 r4234 - /branches/1.2/xpp/card_pri.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Sun May 4 03:04:36 CDT 2008


Author: tzafrir
Date: Sun May  4 03:04:36 2008
New Revision: 4234

URL: http://svn.digium.com/view/zaptel?view=rev&rev=4234
Log:
* Allow initialization of T1-s (r5665) .
* Remove some false alarms on T1-s (r5669) .

Modified:
    branches/1.2/xpp/card_pri.c

Modified: branches/1.2/xpp/card_pri.c
URL: http://svn.digium.com/view/zaptel/branches/1.2/xpp/card_pri.c?view=diff&rev=4234&r1=4233&r2=4234
==============================================================================
--- branches/1.2/xpp/card_pri.c (original)
+++ branches/1.2/xpp/card_pri.c Sun May  4 03:04:36 2008
@@ -66,6 +66,7 @@
 static int proc_xpd_register_write(struct file *file, const char __user *buffer, unsigned long count, void *data);
 static int pri_startup(struct zt_span *span);
 static int pri_shutdown(struct zt_span *span);
+static int pri_lineconfig(xpd_t *xpd, int lineconfig);
 
 #define	PROC_REGISTER_FNAME	"slics"
 #define	PROC_PRI_INFO_FNAME	"pri_info"
@@ -175,8 +176,9 @@
 };
 
 #define	REG_FRS0	0x4C	/* Framer Receive Status Register 0 */
+#define	REG_FRS0_T1_FSR	BIT(0)	/* T1 - Frame Search Restart Flag */
 #define	REG_FRS0_LMFA	BIT(1)	/* Loss of Multiframe Alignment */
-#define	REG_FRS0_NMF	BIT(2)	/* No Multiframe Alignment Found */
+#define	REG_FRS0_E1_NMF	BIT(2)	/* E1 - No Multiframe Alignment Found */
 #define	REG_FRS0_RRA	BIT(4)	/* Receive Remote Alarm: T1-YELLOW-Alarm */
 #define	REG_FRS0_LFA	BIT(5)	/* Loss of Frame Alignment */
 #define	REG_FRS0_AIS	BIT(6)	/* Alarm Indication Signal: T1-BLUE-Alarm */
@@ -400,7 +402,9 @@
 					REG_FMR1_AFR |
 					REG_FMR1_XFS |
 					REG_FMR1_ECM;
+	int			default_lineconfig = 0;
 	byte			rc0 = 0;	/* FIXME: PCM offsets */
+	int			ret;
 
 	BUG_ON(!xpd);
 	priv = xpd->priv;
@@ -413,10 +417,12 @@
 		case PRI_PROTO_E1:
 			deflaw = ZT_LAW_ALAW;
 			dchan_num = 16;
+			default_lineconfig = ZT_CONFIG_CRC4 | ZT_CONFIG_HDB3;
 			break;
 		case PRI_PROTO_T1:
 			deflaw = ZT_LAW_MULAW;
 			dchan_num = 24;
+			default_lineconfig = ZT_CONFIG_ESF | ZT_CONFIG_B8ZS;
 			fmr1 |= REG_FMR1_PMOD;
 			break;
 		case PRI_PROTO_J1:
@@ -427,6 +433,7 @@
 			dchan_num = 24;
 			fmr1 |= REG_FMR1_PMOD;
 			rc0 |= REG_RC0_SJR;
+			default_lineconfig = 0;	/* FIXME: J1??? */
 			XPD_NOTICE(xpd, "J1 is not supported yet\n");
 			return -ENOSYS;
 		default:
@@ -452,6 +459,15 @@
 	if(rc0)
 		write_subunit(xpd, REG_RC0, rc0);
 #endif
+	/*
+	 * Must set default now, so layer1 polling (Register REG_FRS0) would
+	 * give reliable results.
+	 */
+	ret = pri_lineconfig(xpd, default_lineconfig);
+	if(ret) {
+		XPD_NOTICE(xpd, "Failed setting PRI default line config\n");
+		return ret;
+	}
 	return 0;
 }
 
@@ -852,15 +868,6 @@
 	 */
 	if(!valid_pri_modes(xpd)) {
 		XPD_NOTICE(xpd, "PRI protocol not set\n");
-		goto err;
-	}
-	/*
-	 * Must set default now, so layer1 polling (Register REG_FRS0) would
-	 * give reliable results.
-	 */
-	ret = pri_lineconfig(xpd, ZT_CONFIG_CCS | ZT_CONFIG_CRC4 | ZT_CONFIG_HDB3);
-	if(ret) {
-		XPD_NOTICE(xpd, "Failed setting PRI default line config\n");
 		goto err;
 	}
 	XPD_DBG(GENERAL, xpd, "done\n");
@@ -1356,12 +1363,15 @@
 	if(data_low & REG_FRS0_RRA)
 		alarms |= ZT_ALARM_YELLOW;
 	priv->layer1_up = alarms == 0;
+#if 0
 	/*
 	 * Some bad bits (e.g: LMFA and NMF have no alarm "colors"
 	 * associated. However, layer1 is still not working if they are set.
+	 * FIXME: These behave differently in E1/T1, so ignore them for while.
 	 */
-	if(data_low & (REG_FRS0_LMFA | REG_FRS0_NMF))
+	if(data_low & (REG_FRS0_LMFA | REG_FRS0_E1_NMF))
 		priv->layer1_up = 0;
+#endif
 	priv->alarms = alarms;
 	if(!priv->layer1_up)
 		dchan_state(xpd, 0);




More information about the svn-commits mailing list