summaryrefslogtreecommitdiff
path: root/wctdm24xxp
diff options
context:
space:
mode:
authormattf <mattf@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2007-10-12 22:25:46 +0000
committermattf <mattf@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2007-10-12 22:25:46 +0000
commitfaf960dd2a72ed9371231ad72992dde873b00232 (patch)
tree24503c713630eb39917cdf2b7c3c00c45174aadc /wctdm24xxp
parent1728533ae5a5bd0a3e73bc8e3ffc52a921279227 (diff)
Merged revisions 3132 via svnmerge from
https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r3132 | mattf | 2007-10-12 17:19:58 -0500 (Fri, 12 Oct 2007) | 1 line Fix for false power alarms, as well as a clock polarity issue ........ git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.4@3133 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'wctdm24xxp')
-rw-r--r--wctdm24xxp/base.c49
1 files changed, 32 insertions, 17 deletions
diff --git a/wctdm24xxp/base.c b/wctdm24xxp/base.c
index 8c979c6..68777fa 100644
--- a/wctdm24xxp/base.c
+++ b/wctdm24xxp/base.c
@@ -1194,7 +1194,7 @@ static inline void wctdm_proslic_recheck_sanity(struct wctdm *wc, int card)
if (wc->mods[card].fxs.palarms < MAX_ALARMS) {
printk("Power alarm (%02x) on module %d, resetting!\n", res, card + 1);
if (wc->mods[card].fxs.lasttxhook == 4)
- wc->mods[card].fxs.lasttxhook = 1;
+ wc->mods[card].fxs.lasttxhook = 0x11;
wc->sethook[card] = CMD_WR(19, res);
#if 0
wc->sethook[card] = CMD_WR(64, wc->mods[card].fxs.lasttxhook);
@@ -1210,12 +1210,21 @@ static inline void wctdm_proslic_recheck_sanity(struct wctdm *wc, int card)
}
#else
res = wc->cmdq[card].isrshadow[1];
- if (!res && (res != wc->mods[card].fxs.lasttxhook)) {
+ /* This makes sure the lasthook was put in reg 64 the linefeed reg */
+ if (((res & 0x0f) | 0x10) == wc->mods[card].fxs.lasttxhook)
+ wc->mods[card].fxs.lasttxhook &= 0x0f;
+
+ res = !res && /* reg 64 has to be zero at last isr read */
+ !(wc->mods[card].fxs.lasttxhook & 0x10 ) && /* not a transition */
+ wc->mods[card].fxs.lasttxhook; /* not an intended zero */
+
+ if (res) {
wc->mods[card].fxs.palarms++;
if (wc->mods[card].fxs.palarms < MAX_ALARMS) {
printk("Power alarm on module %d, resetting!\n", card + 1);
if (wc->mods[card].fxs.lasttxhook == 4)
- wc->mods[card].fxs.lasttxhook = 1;
+ wc->mods[card].fxs.lasttxhook = 0x11;
+ wc->mods[card].fxs.lasttxhook |= 0x10;
wc->sethook[card] = CMD_WR(64, wc->mods[card].fxs.lasttxhook);
/* wctdm_setreg_intr(wc, card, 64, wc->mods[card].fxs.lasttxhook); */
@@ -1552,7 +1561,7 @@ static inline void wctdm_isr_misc(struct wctdm *wc)
wc->mods[x].fxs.idletxhookstate = 0x1; /* Switch to active */
if (wc->mods[x].fxs.lasttxhook == 0x2) {
/* Apply the change if appropriate */
- wc->mods[x].fxs.lasttxhook = 0x1;
+ wc->mods[x].fxs.lasttxhook = 0x11;
wc->sethook[x] = CMD_WR(64, wc->mods[x].fxs.lasttxhook);
/* wctdm_setreg_intr(wc, x, 64, wc->mods[x].fxs.lasttxhook); */
}
@@ -2100,6 +2109,7 @@ static int wctdm_init_proslic(struct wctdm *wc, int card, int fast, int manual,
/* By default, don't send on hook */
wc->mods[card].fxs.idletxhookstate = 1;
+ wc->mods[card].fxs.lasttxhook = 0x10;
/* Sanity check the ProSLIC */
if (!sane && wctdm_proslic_insane(wc, card))
@@ -2289,7 +2299,7 @@ static int wctdm_init_proslic(struct wctdm *wc, int card, int fast, int manual,
}
}
- if(fxstxgain || fxsrxgain) {
+ if (fxstxgain || fxsrxgain) {
r9 = wctdm_getreg(wc, card, 9);
switch (fxstxgain) {
@@ -2314,14 +2324,14 @@ static int wctdm_init_proslic(struct wctdm *wc, int card, int fast, int manual,
case 0:
break;
}
- wctdm_setreg(wc,card,9,r9);
+ wctdm_setreg(wc, card, 9, r9);
}
- if(debug)
- printk("DEBUG: fxstxgain:%s fxsrxgain:%s\n",((wctdm_getreg(wc, card, 9)/8) == 1)?"3.5":(((wctdm_getreg(wc,card,9)/4) == 1)?"-3.5":"0.0"),((wctdm_getreg(wc, card, 9)/2) == 1)?"3.5":((wctdm_getreg(wc,card,9)%2)?"-3.5":"0.0"));
+ if (debug)
+ printk("DEBUG: fxstxgain:%s fxsrxgain:%s\n",((wctdm_getreg(wc, card, 9)/8) == 1)?"3.5":(((wctdm_getreg(wc,card,9)/4) == 1)?"-3.5":"0.0"),((wctdm_getreg(wc, card, 9)/2) == 1)?"3.5":((wctdm_getreg(wc,card,9)%2)?"-3.5":"0.0"));
+ wc->mods[card].fxs.lasttxhook = 0x11;
wctdm_setreg(wc, card, 64, 0x01);
- wc->mods[card].fxs.lasttxhook = 1;
return 0;
}
@@ -2507,7 +2517,7 @@ static int wctdm_ioctl(struct zt_chan *chan, unsigned int cmd, unsigned long dat
wc->mods[chan->chanpos - 1].fxs.idletxhookstate = 0x2; /* OHT mode when idle */
if (wc->mods[chan->chanpos - 1].fxs.lasttxhook == 0x1) {
/* Apply the change if appropriate */
- wc->mods[chan->chanpos - 1].fxs.lasttxhook = 0x2;
+ wc->mods[chan->chanpos - 1].fxs.lasttxhook = 0x12;
wc->sethook[chan->chanpos - 1] = CMD_WR(64, wc->mods[chan->chanpos - 1].fxs.lasttxhook);
/* wctdm_setreg(wc, chan->chanpos - 1, 64, wc->mods[chan->chanpos - 1].fxs.lasttxhook); */
}
@@ -2554,6 +2564,9 @@ static int wctdm_ioctl(struct zt_chan *chan, unsigned int cmd, unsigned long dat
wctdm_proslic_setreg_indirect(wc, chan->chanpos - 1, regop.reg, regop.val);
} else {
regop.val &= 0xff;
+ if (regop.reg == 64)
+ wc->mods[chan->chanpos-1].fxs.lasttxhook = (regop.val & 0x0f) | 0x10;
+
printk("Setting direct %d to %04x on %d\n", regop.reg, regop.val, chan->chanpos);
wctdm_setreg(wc, chan->chanpos - 1, regop.reg, regop.val);
}
@@ -2859,28 +2872,30 @@ static int wctdm_hooksig(struct zt_chan *chan, zt_txsig_t txsig)
case ZT_SIG_EM:
case ZT_SIG_FXOKS:
case ZT_SIG_FXOLS:
- wc->mods[chan->chanpos - 1].fxs.lasttxhook = wc->mods[chan->chanpos - 1].fxs.idletxhookstate;
+ wc->mods[chan->chanpos - 1].fxs.lasttxhook = 0x10 |
+ wc->mods[chan->chanpos - 1].fxs.idletxhookstate;
break;
case ZT_SIG_FXOGS:
- wc->mods[chan->chanpos - 1].fxs.lasttxhook = 3;
+ wc->mods[chan->chanpos - 1].fxs.lasttxhook = 0x13;
break;
}
break;
case ZT_TXSIG_OFFHOOK:
switch(chan->sig) {
case ZT_SIG_EM:
- wc->mods[chan->chanpos - 1].fxs.lasttxhook = 5;
+ wc->mods[chan->chanpos - 1].fxs.lasttxhook = 0x15;
break;
default:
- wc->mods[chan->chanpos - 1].fxs.lasttxhook = wc->mods[chan->chanpos - 1].fxs.idletxhookstate;
+ wc->mods[chan->chanpos - 1].fxs.lasttxhook = 0x10 |
+ wc->mods[chan->chanpos - 1].fxs.idletxhookstate;
break;
}
break;
case ZT_TXSIG_START:
- wc->mods[chan->chanpos - 1].fxs.lasttxhook = 4;
+ wc->mods[chan->chanpos - 1].fxs.lasttxhook = 0x14;
break;
case ZT_TXSIG_KEWL:
- wc->mods[chan->chanpos - 1].fxs.lasttxhook = 0;
+ wc->mods[chan->chanpos - 1].fxs.lasttxhook = 0x10;
break;
default:
printk("wctdm24xxp: Can't set tx state to %d\n", txsig);
@@ -3370,7 +3385,7 @@ static int vpm150m_config_hw(struct wctdm *wc)
portconfig.TxFrameSyncPolarity3 = FrameSyncActHigh;
portconfig.RxFrameSyncPolarity3 = FrameSyncActHigh;
portconfig.TxClockPolarity3 = SerClockActHigh;
- portconfig.RxClockPolarity3 = SerClockActHigh;
+ portconfig.RxClockPolarity3 = SerClockActLow;
portconfig.TxDataDelay3 = DataDelay0;
portconfig.RxDataDelay3 = DataDelay0;
portconfig.DxDelay3 = Disabled;