From 405ef8821d64e3b86d89f954f6c2ae36b49f29b9 Mon Sep 17 00:00:00 2001 From: mattf Date: Sat, 22 Sep 2007 20:18:10 +0000 Subject: Make some improvements in how we do event retrieval git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.4@3082 5390a7c7-147a-4af0-8ec9-7488f05a26cb --- wct4xxp/base.c | 62 ++++++++++++++++++++++++++++------------------------------ 1 file changed, 30 insertions(+), 32 deletions(-) (limited to 'wct4xxp') diff --git a/wct4xxp/base.c b/wct4xxp/base.c index d56785e..55fe88e 100644 --- a/wct4xxp/base.c +++ b/wct4xxp/base.c @@ -725,44 +725,42 @@ static const char vpm_digits[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', ' static void t4_check_vpm450(struct t4 *wc) { int channel, tone, start, span; -#if 1 - /* There's no point checking the interrupt, it's pointless. */ + if (vpm450m_checkirq(wc->vpm450m)) { -#endif - while(vpm450m_getdtmf(wc->vpm450m, &channel, &tone, &start)) { - span = channel & 0x3; - channel >>= 2; - if (!wc->t1e1) - channel -= 5; - else - channel -= 1; - if (unlikely(debug)) - printk("Got tone %s of '%c' on channel %d of span %d\n", - (start ? "START" : "STOP"), tone, channel, span + 1); - if (test_bit(channel, &wc->tspans[span]->dtmfmask) && (tone != 'u')) { - if (start) { - /* The octasic is supposed to mute us, but... Yah, you - guessed it. */ - if (test_bit(channel, &wc->tspans[span]->dtmfmutemask)) { - unsigned long flags; - struct zt_chan *chan = &wc->tspans[span]->span.chans[channel]; - int y; - spin_lock_irqsave(&chan->lock, flags); - for (y=0;ynumbufs;y++) { - if ((chan->inreadbuf > -1) && (chan->readidx[y])) - memset(chan->readbuf[chan->inreadbuf], ZT_XLAW(0, chan), chan->readidx[y]); + while(vpm450m_getdtmf(wc->vpm450m, &channel, &tone, &start)) { + span = channel & 0x3; + channel >>= 2; + if (!wc->t1e1) + channel -= 5; + else + channel -= 1; + if (unlikely(debug)) + printk("Got tone %s of '%c' on channel %d of span %d\n", + (start ? "START" : "STOP"), tone, channel, span + 1); + if (test_bit(channel, &wc->tspans[span]->dtmfmask) && (tone != 'u')) { + if (start) { + /* The octasic is supposed to mute us, but... Yah, you + guessed it. */ + if (test_bit(channel, &wc->tspans[span]->dtmfmutemask)) { + unsigned long flags; + struct zt_chan *chan = &wc->tspans[span]->span.chans[channel]; + int y; + spin_lock_irqsave(&chan->lock, flags); + for (y=0;ynumbufs;y++) { + if ((chan->inreadbuf > -1) && (chan->readidx[y])) + memset(chan->readbuf[chan->inreadbuf], ZT_XLAW(0, chan), chan->readidx[y]); + } + spin_unlock_irqrestore(&chan->lock, flags); } - spin_unlock_irqrestore(&chan->lock, flags); + set_bit(channel, &wc->tspans[span]->dtmfactive); + zt_qevent_lock(&wc->tspans[span]->span.chans[channel], (ZT_EVENT_DTMFDOWN | tone)); + } else { + clear_bit(channel, &wc->tspans[span]->dtmfactive); + zt_qevent_lock(&wc->tspans[span]->span.chans[channel], (ZT_EVENT_DTMFUP | tone)); } - set_bit(channel, &wc->tspans[span]->dtmfactive); - zt_qevent_lock(&wc->tspans[span]->span.chans[channel], (ZT_EVENT_DTMFDOWN | tone)); - } else { - clear_bit(channel, &wc->tspans[span]->dtmfactive); - zt_qevent_lock(&wc->tspans[span]->span.chans[channel], (ZT_EVENT_DTMFUP | tone)); } } } - } } static void t4_check_vpm400(struct t4 *wc, unsigned int newio) -- cgit v1.2.3