diff options
author | tzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2006-09-04 22:44:10 +0000 |
---|---|---|
committer | tzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2006-09-04 22:44:10 +0000 |
commit | 80e84d41daf7ea1a88765b3621a653769fb843ac (patch) | |
tree | 5b55d66f9d39b34f06ad21dc445722bf5ab0c235 /xpp/xpp_zap.c | |
parent | 909d1e663eab279fa8736a0d14fda263b66e9556 (diff) |
Send ring signalling to zaptel directly from card_fxo.c:
no need to xpp_ring_generate()
git-svn-id: http://svn.digium.com/svn/zaptel/trunk@1388 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'xpp/xpp_zap.c')
-rw-r--r-- | xpp/xpp_zap.c | 47 |
1 files changed, 10 insertions, 37 deletions
diff --git a/xpp/xpp_zap.c b/xpp/xpp_zap.c index 3aad1d4..02604f5 100644 --- a/xpp/xpp_zap.c +++ b/xpp/xpp_zap.c @@ -79,7 +79,6 @@ DEF_PARM(bool, zap_autoreg, 1, "Register spans automatically (1) or not (0)"); static int zaptel_register_xpd(xpd_t *xpd); static int zaptel_unregister_xpd(xpd_t *xpd); -static void xpp_ring_generate(xpd_t *xpd); static void xpp_transmitprep(xpd_t *xpd); static void xpp_receiveprep(xpd_t *xpd); static int xpd_read_proc(char *page, char **start, off_t off, int count, int *eof, void *data); @@ -178,8 +177,6 @@ void xpp_tick(unsigned long param) CALL_XMETHOD(card_tick, xbus, xpd); if(!SPAN_REGISTERED(xpd)) continue; - if(xpd->direction == TO_PSTN) - xpp_ring_generate(xpd); xpp_transmitprep(xpd); xpp_receiveprep(xpd); } @@ -638,43 +635,18 @@ void update_line_status(xpd_t *xpd, int pos, bool good) #define RING_TIME 15 /* in ticks */ -static void xpp_ring_generate(xpd_t *xpd) +void update_zap_ring(xpd_t *xpd, int pos, bool on) { - int i; - static int bug_counter = 0; - unsigned long flags; + struct zt_chan *chan; BUG_ON(!xpd); - - spin_lock_irqsave(&xpd->lock, flags); - if(xpd->direction != TO_PSTN && ((bug_counter++ % 1000) == 0)) { - ERR("%s: %s: Only FXO can report ring changes\n", __FUNCTION__, xpd->xpdname); - goto out; - } - if(!SPAN_REGISTERED(xpd)) { - NOTICE("%s: %s is not registered. Skipping.\n", __FUNCTION__, xpd->xpdname); - goto out; - } - /* - * Ring detect logic: - * fxo_power is toggled - */ - for_each_line(xpd, i) { - if(xpd->ringing[i] || xpd->ringer_on[i]) { - // ring state is only changed once per second: - if((xpd->timer_count % RING_TIME) == 0) { - DBG("pos=%d ringing=%d ringer_on=%d\n", i, xpd->ringing[i], xpd->ringer_on[i]); - if(xpd->ringer_on[i]) { - zt_hooksig(&xpd->chans[i], ZT_RXSIG_OFFHOOK); - } else { - zt_hooksig(&xpd->chans[i], ZT_RXSIG_RING); - } - xpd->ringer_on[i] = !xpd->ringer_on[i]; - } - } - } -out: - spin_unlock_irqrestore(&xpd->lock, flags); + if(!SPAN_REGISTERED(xpd)) + return; + chan = &xpd->chans[pos]; + if(on) + zt_hooksig(chan, ZT_RXSIG_RING); + else + zt_hooksig(chan, ZT_RXSIG_OFFHOOK); } #ifdef CONFIG_PROC_FS @@ -1583,6 +1555,7 @@ EXPORT_SYMBOL(xpd_alloc); EXPORT_SYMBOL(xpd_disconnect); EXPORT_SYMBOL(packet_send); EXPORT_SYMBOL(update_xpd_status); +EXPORT_SYMBOL(update_zap_ring); EXPORT_SYMBOL(update_line_status); EXPORT_SYMBOL(fill_beep); EXPORT_SYMBOL(xpp_tick); |