diff options
Diffstat (limited to 'xpp/xpp_zap.c')
-rw-r--r-- | xpp/xpp_zap.c | 81 |
1 files changed, 28 insertions, 53 deletions
diff --git a/xpp/xpp_zap.c b/xpp/xpp_zap.c index 1fc7b37..00d7e4d 100644 --- a/xpp/xpp_zap.c +++ b/xpp/xpp_zap.c @@ -91,10 +91,15 @@ DEF_PARM_BOOL(sync_tick_active, 1, 0644, "Measure via zaptel sync_tick() method" DEF_PARM_BOOL(pcm_tasklet, 0, 0644, "Handle PCM in a tasklet (lower interrupt load)"); +#define PCM_TASKLET_DEPRECATION "\n" \ + "====================================================================\n" \ + "CONFIGURATION ERROR: 'pcm_tasklet' module parameter is deprecated!!!\n" \ + "====================================================================\n" + DEF_PARM(int, disable_pcm, 0, 0644, "Disable all PCM transmissions"); DEF_PARM(int, print_dbg, 0, 0644, "Print DBG statements"); DEF_PARM_BOOL(zap_autoreg, 0, 0644, "Register spans automatically (1) or not (0)"); -DEF_PARM_BOOL(prefmaster, 1, 0644, "Do we want to be zaptel preferred sync master"); +DEF_PARM_BOOL(prefmaster, 0, 0644, "Do we want to be zaptel preferred sync master"); #ifdef XPP_EC_CHUNK DEF_PARM_BOOL(xpp_ec, 0, 0444, "Do we use our own (1) or Zaptel's (0) echo canceller"); #else @@ -161,8 +166,6 @@ static int proc_xpd_ztregister_write(struct file *file, const char __user *buffe static int proc_xpd_blink_read(char *page, char **start, off_t off, int count, int *eof, void *data); static int proc_xpd_blink_write(struct file *file, const char __user *buffer, unsigned long count, void *data); static void xpd_free(xpd_t *xpd); -static DECLARE_TASKLET(tasklet_tick, xpp_tick, 0L); -static atomic_t missed_ticks = ATOMIC_INIT(0); /* In pcm_tasklet mode */ static void external_sync(xbus_t *the_xbus) { @@ -198,9 +201,7 @@ static void sync_master_is(const char *msg, xbus_t *xbus) (sync_master) ? sync_master->xbus->busname : "HOST", (xbus) ? xbus->busname : "HOST"); /* First stop all generators */ - if(sync_master) { - tasklet_kill(&tasklet_tick); - } else + if(!sync_master) del_timer_sync(&xpp_timer); /* Now set a new master */ sync_master = xpd; @@ -244,10 +245,10 @@ void elect_syncer(const char *msg) } } if(!best_xpd) { - INFO("%s: elected HOST\n", msg); + DBG(GENERAL, "%s: elected HOST\n", msg); sync_master_is(msg, NULL); } else if(!sync_master || (timing_priority > sync_master->timing_priority)) { - XPD_INFO(best_xpd, "%s: elected with priority %d\n", msg, timing_priority); + XPD_DBG(GENERAL, best_xpd, "%s: elected with priority %d\n", msg, timing_priority); sync_master_is(msg, best_xpd->xbus); } } @@ -414,9 +415,8 @@ static void xbus_tick(xbus_t *xbus) } pack = xframe_next_packet(xframe, pcm_len); } while(!pack); - XPACKET_INIT(pack, GLOBAL, PCM_WRITE); - xpd_set_addr(&pack->addr, xpd->xbus_idx); - pack->datalen = pcm_len; + XPACKET_INIT(pack, GLOBAL, PCM_WRITE, xpd->xbus_idx); + XPACKET_LEN(pack) = pcm_len; CALL_XMETHOD(card_pcm_fromspan, xbus, xpd, xpd->wanted_pcm_mask, pack); XBUS_COUNTER(xbus, TX_PACK_PCM)++; } @@ -457,8 +457,6 @@ void xpp_tick(unsigned long param) #endif if(!sync_master) /* Called from timer */ mod_timer(&xpp_timer, jiffies + 1); /* Must be 1KHz rate */ - else - atomic_dec(&missed_ticks); /* Statistics */ if((xpp_timer_count % SAMPLE_TICKS) == 0) { xpp_last_jiffies = jiffies; @@ -499,12 +497,7 @@ void got_sync_from(xpd_t *xpd) XPD_DBG(SYNC, xpd, "is not SYNC master. Go away! (%d)\n", rate_limit); return; } - atomic_inc(&missed_ticks); - if(!pcm_tasklet) { - xpp_tick(0L); - return; - } - tasklet_schedule(&tasklet_tick); + xpp_tick(0L); } #ifdef ZAPTEL_SYNC_TICK @@ -641,23 +634,6 @@ static void xpd_free(xpd_t *xpd) /*------------------------- XPD Management -------------------------*/ -#define REV(x,y) (10 * (x) + (y)) -static byte good_revs[] = { - REV(2,6), -}; -#undef REV - -static bool good_rev(byte rev) -{ - int i; - - for(i = 0; i < ARRAY_SIZE(good_revs); i++) { - if(good_revs[i] == rev) - return 1; - } - return 0; -} - /* * Synchronous part of XPD detection. * Called from xbus_poll() @@ -684,15 +660,6 @@ void card_detected(struct card_desc_struct *card_desc) subunit = card_desc->xpd_addr.subunit; rev = card_desc->rev; BUG_ON(!xbus); - if(!good_rev(rev)) { - XBUS_NOTICE(xbus, "XPD at %d%d: type=%d.%d has bad firmware revision %d.%d\n", - unit, subunit, - type, subtype, - rev / 10, rev % 10); - goto err; - } - XBUS_INFO(xbus, "New XPD at %d%d type=%d.%d Revision %d.%d\n", - unit, subunit, type, subtype, rev / 10, rev % 10); xpd = xpd_byaddr(xbus, unit, subunit); if(xpd) { if(type == XPD_TYPE_NOMODULE) { @@ -733,13 +700,13 @@ void card_detected(struct card_desc_struct *card_desc) xpd->offhook = card_desc->line_status; /* For USB-1 disable some channels */ - if(xbus->max_packet_size < RPACKET_SIZE(GLOBAL, PCM_WRITE)) { + if(xbus->max_xframe_size < RPACKET_SIZE(GLOBAL, PCM_WRITE)) { xpp_line_t no_pcm; no_pcm = 0x7F | xpd->digital_outputs | xpd->digital_inputs; xpd->no_pcm = no_pcm; - XBUS_NOTICE(xbus, "max packet size = %d, disabling some PCM channels. no_pcm=0x%04X\n", - xbus->max_packet_size, xpd->no_pcm); + XBUS_NOTICE(xbus, "max xframe size = %d, disabling some PCM channels. no_pcm=0x%04X\n", + xbus->max_xframe_size, xpd->no_pcm); } xbus_register_xpd(xbus, xpd); #ifdef CONFIG_PROC_FS @@ -785,6 +752,7 @@ void card_detected(struct card_desc_struct *card_desc) xbus->last_rx_sync = xbus->last_tx_sync; } CALL_XMETHOD(XPD_STATE, xbus, xpd, 1); /* Turn on all channels */ + XPD_INFO(xpd, "Initialized: %s\n", xpd->type_name); if(zap_autoreg) zaptel_register_xpd(xpd); @@ -833,6 +801,7 @@ static int xpd_read_proc(char *page, char **start, off_t off, int count, int *eo len += sprintf(page + len, "Type: %d.%d\n\n", xpd->type, xpd->subtype); len += sprintf(page + len, "pcm_len=%d\n\n", xpd->pcm_len); len += sprintf(page + len, "wanted_pcm_mask=0x%04X\n\n", xpd->wanted_pcm_mask); + len += sprintf(page + len, "mute_dtmf=0x%04X\n\n", xpd->mute_dtmf); len += sprintf(page + len, "STATES:"); len += sprintf(page + len, "\n\t%-17s: ", "output_relays"); for_each_line(xpd, i) { @@ -864,7 +833,7 @@ static int xpd_read_proc(char *page, char **start, off_t off, int count, int *eo } #if 1 if(SPAN_REGISTERED(xpd)) { - len += sprintf(page + len, "\nPCM:\n | [readchunk] | [writechunk] | pass"); + len += sprintf(page + len, "\nPCM:\n | [readchunk] | [writechunk] | W D"); for_each_line(xpd, i) { struct zt_chan *chans = xpd->span.chans; byte rchunk[ZT_CHUNKSIZE]; @@ -879,7 +848,7 @@ static int xpd_read_proc(char *page, char **start, off_t off, int count, int *eo continue; if(IS_SET(xpd->digital_signalling, i)) continue; -#if 0 +#if 1 rp = chans[i].readchunk; #else rp = (byte *)xpd->readchunk + (ZT_CHUNKSIZE * i); @@ -897,6 +866,8 @@ static int xpd_read_proc(char *page, char **start, off_t off, int count, int *eo } len += sprintf(page + len, " | %c", (IS_SET(xpd->wanted_pcm_mask, i))?'+':' '); + len += sprintf(page + len, " %c", + (IS_SET(xpd->mute_dtmf, i))?'-':' '); } } #endif @@ -1149,7 +1120,7 @@ noextsync: len += sprintf(page + len, "tick rate: %4d/second (SAMPLE_TICKS=%d)\n", xpp_timer_rate, SAMPLE_TICKS); } if(pcm_tasklet) - len += sprintf(page + len, "TASKLETS: missed_ticks: %d\n", atomic_read(&missed_ticks)); + len += sprintf(page + len, PCM_TASKLET_DEPRECATION); if (len <= off+count) *eof = 1; *start = page + off; @@ -1312,6 +1283,8 @@ void pcm_recompute(xpd_t *xpd, xpp_line_t pcm_mask) unsigned long flags; pcm_mask &= ~xpd->digital_signalling; /* without D-Channel */ + pcm_mask &= ~xpd->digital_inputs; + pcm_mask &= ~xpd->digital_outputs; for_each_line(xpd, i) if(IS_SET(pcm_mask, i)) line_count++; @@ -1431,7 +1404,8 @@ static void xpp_receiveprep(xpd_t *xpd) */ if(unlikely(IS_SET(xpd->digital_signalling, i))) continue; - if(IS_SET(xpd->offhook, i) || IS_SET(xpd->cid_on, i) || IS_BRI(xpd)) { + if(!IS_SET(xpd->mute_dtmf, i) && + (IS_SET(xpd->offhook, i) || IS_SET(xpd->cid_on, i) || IS_BRI(xpd))) { // memset((u_char *)readchunk, 0x5A, ZT_CHUNKSIZE); // DEBUG // fill_beep((u_char *)readchunk, 1, 1); // DEBUG: BEEP memcpy(chans[i].readchunk, (u_char *)readchunk, ZT_CHUNKSIZE); @@ -1777,7 +1751,6 @@ static void do_cleanup(void) { if(timer_pending(&xpp_timer)) del_timer_sync(&xpp_timer); - tasklet_kill(&tasklet_tick); #ifdef CONFIG_PROC_FS DBG(GENERAL, "Removing '%s' from proc\n", PROC_SYNC); remove_proc_entry(PROC_SYNC, xpp_proc_toplevel); @@ -1843,6 +1816,8 @@ int __init xpp_zap_init(void) /* Only timer init. We add it only *after* zt_register */ init_timer(&xpp_timer); sync_master_is("INIT", NULL); /* Internal ticking */ + if(pcm_tasklet) + ERR(PCM_TASKLET_DEPRECATION); return 0; err: do_cleanup(); |