summaryrefslogtreecommitdiff
path: root/xpp/card_pri.c
diff options
context:
space:
mode:
authortzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2007-12-19 21:15:04 +0000
committertzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2007-12-19 21:15:04 +0000
commit47c37e8fb66d3f61956efcc6154828e311f1f40f (patch)
tree40d1cce58f8b2a3b8be0ec3ae0207985e909ff14 /xpp/card_pri.c
parent0525730accbcf75ce41cd30f3bc36a6392763c3b (diff)
* A few more fixes to card_pri.
* Do use "crc4" for E1 by default when generating zaptel.conf . git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.2@3540 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'xpp/card_pri.c')
-rw-r--r--xpp/card_pri.c49
1 files changed, 40 insertions, 9 deletions
diff --git a/xpp/card_pri.c b/xpp/card_pri.c
index 483fc47..c82eb6d 100644
--- a/xpp/card_pri.c
+++ b/xpp/card_pri.c
@@ -133,6 +133,7 @@ static int pri_linecompat(enum pri_protocol pri_protocol)
/* coding */
ZT_CONFIG_CCS |
// CAS |
+ ZT_CONFIG_CRC4 |
/* framing */
ZT_CONFIG_AMI | ZT_CONFIG_HDB3,
[PRI_PROTO_T1] =
@@ -185,6 +186,8 @@ struct pri_leds {
#define REG_FRS1 0x4D /* Framer Receive Status Register 1 */
#define REG_LIM0 0x36
+#define REG_LIM0_MAS BIT(0) /* Master Mode, DCO-R circuitry is frequency
+ synchronized to the clock supplied by SYNC */
#define REG_LIM0_RTRS BIT(5) /*
* Receive Termination Resistance Selection:
* integrated resistor to create 75 Ohm termination (100 || 300 = 75)
@@ -223,6 +226,14 @@ struct pri_leds {
#define REG_FMR4 0x20
#define REG_FMR4_FM1 BIT(1)
+#define REG_XSP_E 0x21
+#define REG_FMR5_T 0x21
+#define REG_XSP_E_XSIF BIT(2) /* Transmit Spare Bit For International Use (FAS Word) */
+#define REG_FMR5_T_XTM BIT(2) /* Transmit Transparent Mode */
+#define REG_XSP_E_AXS BIT(3) /* Automatic Transmission of Submultiframe Status */
+#define REG_XSP_E_EBP BIT(4) /* E-Bit Polarity, Si-bit position of every outgoing CRC multiframe */
+#define REG_XSP_E_CASEN BIT(7) /* Channel Associated Signaling Enable */
+
#define REG_RC0 0x24
#define REG_RC0_SJR BIT(7) /* T1 = 0, J1 = 1 */
@@ -435,17 +446,27 @@ static int set_pri_proto(xpd_t *xpd, enum pri_protocol set_proto)
static int set_master_mode(const char *msg, xpd_t *xpd, bool is_master_mode)
{
struct PRI_priv_data *priv;
- byte lim0 = REG_LIM0_RTRS;
+ byte lim0 = 0;
+ byte xsp = 0;
BUG_ON(!xpd);
priv = xpd->priv;
lim0 |= (priv->local_loopback) ? REG_LIM0_LL : 0;
if(is_master_mode)
- lim0 |= 0x01;
+ lim0 |= REG_LIM0_MAS;
else
- lim0 &= ~0x01;
+ lim0 &= ~REG_LIM0_MAS;
+ if(priv->pri_protocol == PRI_PROTO_E1)
+ {
+ lim0 |= REG_LIM0_RTRS; /* Receive termination: Integrated resistor is switched on (100 Ohm || 300 Ohm = 75 Ohm) */
+ xsp |= REG_XSP_E_EBP | REG_XSP_E_AXS | REG_XSP_E_XSIF;
+ } else if(priv->pri_protocol == PRI_PROTO_T1) {
+ lim0 &= ~REG_LIM0_RTRS; /* Receive termination: Integrated resistor is switched off (100 Ohm, no internal 300 Ohm) */;
+ xsp |= REG_FMR5_T_XTM;
+ }
XPD_DBG(SIGNAL, xpd, "%s(%s): %s\n", __FUNCTION__, msg, (is_master_mode) ? "MASTER" : "SLAVE");
- write_subunit(xpd, REG_LIM0, lim0);
+ write_subunit(xpd, REG_LIM0 , lim0);
+ write_subunit(xpd, REG_XSP_E, xsp);
return 0;
}
@@ -471,7 +492,8 @@ static int set_nt(const char *msg, xpd_t *xpd, bool is_nt)
static int set_localloop(const char *msg, xpd_t *xpd, bool localloop)
{
struct PRI_priv_data *priv;
- byte lim0 = REG_LIM0_RTRS;
+ byte lim0 = 0;
+ byte xsp = 0;
BUG_ON(!xpd);
priv = xpd->priv;
@@ -482,12 +504,21 @@ static int set_localloop(const char *msg, xpd_t *xpd, bool localloop)
}
lim0 |= (localloop) ? REG_LIM0_LL : 0;
if(priv->is_nt)
- lim0 |= 0x01;
+ lim0 |= REG_LIM0_MAS;
else
- lim0 &= ~0x01;
+ lim0 &= ~REG_LIM0_MAS;
+ if(priv->pri_protocol == PRI_PROTO_E1)
+ {
+ lim0 |= REG_LIM0_RTRS; /* Receive termination: Integrated resistor is switched on (100 Ohm || 300 Ohm = 75 Ohm) */
+ xsp |= REG_XSP_E_EBP | REG_XSP_E_AXS | REG_XSP_E_XSIF;
+ } else if(priv->pri_protocol == PRI_PROTO_T1) {
+ lim0 &= ~REG_LIM0_RTRS ; /* Receive termination: Integrated resistor is switched off (100 Ohm, no internal 300 Ohm) */;
+ xsp |= REG_FMR5_T_XTM;
+ }
priv->local_loopback = localloop;
XPD_DBG(SIGNAL, xpd, "%s(%s): %s\n", __FUNCTION__, msg, (localloop) ? "LOCALLOOP" : "NO");
- write_subunit(xpd, REG_LIM0, lim0);
+ write_subunit(xpd, REG_LIM0 , lim0);
+ write_subunit(xpd, REG_XSP_E, xsp);
return 0;
}
@@ -1017,7 +1048,7 @@ static void PRI_card_pcm_fromspan(xbus_t *xbus, xpd_t *xpd, xpp_line_t lines, xp
}
} else if(priv->pri_protocol == PRI_PROTO_T1) {
/* In T1 - Every 4'th channel is unused */
- if((i % 4) == 0) {
+ if((i % 3) == 0) {
physical_chan++;
}
}