summaryrefslogtreecommitdiff
path: root/wct4xxp
diff options
context:
space:
mode:
authormattf <mattf@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2007-09-22 20:18:10 +0000
committermattf <mattf@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2007-09-22 20:18:10 +0000
commit405ef8821d64e3b86d89f954f6c2ae36b49f29b9 (patch)
tree6ec6124d953e981258dc22a14fe733ec5d7d7456 /wct4xxp
parentab04891a51b4e483960030ddf66fa12e6df2a171 (diff)
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
Diffstat (limited to 'wct4xxp')
-rw-r--r--wct4xxp/base.c62
1 files changed, 30 insertions, 32 deletions
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;y<chan->numbufs;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;y<chan->numbufs;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)