summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2008-05-04 08:04:36 +0000
committertzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2008-05-04 08:04:36 +0000
commitaee310d11e62a33c09bf7db1d034db8986155fae (patch)
tree2220d0a5c486ad77899908bc6ac9dfbe965b686b
parent52070b595a861d3d62d2cc1e60539d3e6cdd410f (diff)
* Allow initialization of T1-s (r5665) .
* Remove some false alarms on T1-s (r5669) . git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.2@4234 5390a7c7-147a-4af0-8ec9-7488f05a26cb
-rw-r--r--xpp/card_pri.c32
1 files changed, 21 insertions, 11 deletions
diff --git a/xpp/card_pri.c b/xpp/card_pri.c
index 08ac650..2187bb7 100644
--- a/xpp/card_pri.c
+++ b/xpp/card_pri.c
@@ -66,6 +66,7 @@ static int proc_xpd_register_read(char *page, char **start, off_t off, int count
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 @@ struct pri_leds {
};
#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 @@ static int set_pri_proto(xpd_t *xpd, enum pri_protocol set_proto)
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 @@ static int set_pri_proto(xpd_t *xpd, enum pri_protocol set_proto)
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 @@ static int set_pri_proto(xpd_t *xpd, enum pri_protocol set_proto)
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 @@ static int set_pri_proto(xpd_t *xpd, enum pri_protocol set_proto)
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;
}
@@ -854,15 +870,6 @@ static int PRI_card_init(xbus_t *xbus, xpd_t *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");
for(ret = 0; ret < NUM_LEDS; ret++) {
DO_LED(xpd, ret, PRI_LED_ON);
@@ -1356,12 +1363,15 @@ static void layer1_state(xpd_t *xpd, byte subunit, byte data_low)
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);