[zaptel-commits] tzafrir: branch 1.4 r4235 - in /branches/1.4: ./ kernel/xpp/card_pri.c

SVN commits to the Zaptel project zaptel-commits at lists.digium.com
Sun May 4 04:56:16 CDT 2008


Author: tzafrir
Date: Sun May  4 04:56:14 2008
New Revision: 4235

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

Merged revisions 4234 via svnmerge from 
http://svn.digium.com/svn/zaptel/branches/1.2

Modified:
    branches/1.4/   (props changed)
    branches/1.4/kernel/xpp/card_pri.c

Propchange: branches/1.4/
------------------------------------------------------------------------------
--- branch-1.2-blocked (original)
+++ branch-1.2-blocked Sun May  4 04:56:14 2008
@@ -1,1 +1,1 @@
-/branches/1.2:917,937,1073,1206,1613,2018,2434,2583,2668,2750,2789,2868,2871,2878,3083,3098-3099,3201,3509,3645,3833,3847,3917,3951,4037-4038,4117
+/branches/1.2:917,937,1073,1206,1613,2018,2434,2583,2668,2750,2789,2868,2871,2878,3083,3098-3099,3201,3509,3645,3833,3847,3917,3951,4037-4038,4117,4233

Propchange: branches/1.4/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.

Modified: branches/1.4/kernel/xpp/card_pri.c
URL: http://svn.digium.com/view/zaptel/branches/1.4/kernel/xpp/card_pri.c?view=diff&rev=4235&r1=4234&r2=4235
==============================================================================
--- branches/1.4/kernel/xpp/card_pri.c (original)
+++ branches/1.4/kernel/xpp/card_pri.c Sun May  4 04:56:14 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 zaptel-commits mailing list