summaryrefslogtreecommitdiff
path: root/wctdm.c
diff options
context:
space:
mode:
authormarkster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2003-10-03 15:38:50 +0000
committermarkster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2003-10-03 15:38:50 +0000
commit56381afe6d3cb96ef12e6454e8f2b9a780333811 (patch)
tree3b5f4d50fd64bd489d5085a4af776a1eb7035804 /wctdm.c
parentd36504ea15b4141cc624b55a71a0b8e97cb66fb5 (diff)
Make power alarm handling less aggressive / more effective
git-svn-id: http://svn.digium.com/svn/zaptel/trunk@249 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'wctdm.c')
-rwxr-xr-xwctdm.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/wctdm.c b/wctdm.c
index 2e6cd86..f0b99c5 100755
--- a/wctdm.c
+++ b/wctdm.c
@@ -246,6 +246,7 @@ static inline void wcfxs_receiveprep(struct wcfxs *wc, unsigned char ints)
}
static inline void wcfxs_check_hook(struct wcfxs *wc, int card);
+static inline void wcfxs_recheck_sanity(struct wcfxs *wc, int card);
static void wcfxs_stop_dma(struct wcfxs *wc);
static void wcfxs_reset_tdm(struct wcfxs *wc);
@@ -281,6 +282,8 @@ static void wcfxs_interrupt(int irq, void *dev_id, struct pt_regs *regs)
x = wc->intcount % 4;
if ((x < wc->cards) && (wc->cardflag & (1 << x))) {
wcfxs_check_hook(wc, x);
+ if (!(wc->intcount & 0xfc))
+ wcfxs_recheck_sanity(wc, x);
}
if (!(wc->intcount % 10000)) {
/* Accept an alarm once per 10 seconds */
@@ -899,14 +902,9 @@ static int wcfxs_init_proslic(struct wcfxs *wc, int card, int fast, int manual,
return 0;
}
-static inline void wcfxs_check_hook(struct wcfxs *wc, int card)
+static inline void wcfxs_recheck_sanity(struct wcfxs *wc, int card)
{
- char res;
- int hook;
-
- /* For some reason we have to debounce the
- hook detector. */
-
+ int res;
/* Check loopback */
res = wcfxs_getreg(wc, card, 8);
if (res) {
@@ -926,6 +924,16 @@ static inline void wcfxs_check_hook(struct wcfxs *wc, int card)
}
}
}
+}
+
+static inline void wcfxs_check_hook(struct wcfxs *wc, int card)
+{
+ char res;
+ int hook;
+
+ /* For some reason we have to debounce the
+ hook detector. */
+
res = wcfxs_getreg(wc, card, 68);
hook = (res & 1);
if (hook != wc->lastrxhook[card]) {