diff options
author | sruffell <sruffell@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2008-04-03 21:11:24 +0000 |
---|---|---|
committer | sruffell <sruffell@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2008-04-03 21:11:24 +0000 |
commit | b88dcb40c9342fa0307e9c8d020db3fbba699c62 (patch) | |
tree | 8ea1c725ea4a909f0747a44f3959464e2f6ff345 /wctdm24xxp | |
parent | 18c27fc575b8195d5a850b885cc94459b21743c3 (diff) |
svn merge -c3012 https://origsvn.digium.com/svn/zaptel/branches/1.4 .
svn merge -c3701 https://origsvn.digium.com/svn/zaptel/branches/1.4 .
svn merge -c3703 https://origsvn.digium.com/svn/zaptel/branches/1.4 .
svn merge -c4050 https://origsvn.digium.com/svn/zaptel/branches/1.4/kernel .
git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.2@4128 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'wctdm24xxp')
-rw-r--r-- | wctdm24xxp/GpakApi.c | 6 | ||||
-rw-r--r-- | wctdm24xxp/base.c | 80 | ||||
-rw-r--r-- | wctdm24xxp/wctdm24xxp.h | 9 |
3 files changed, 74 insertions, 21 deletions
diff --git a/wctdm24xxp/GpakApi.c b/wctdm24xxp/GpakApi.c index 8f03c7f..70d6b35 100644 --- a/wctdm24xxp/GpakApi.c +++ b/wctdm24xxp/GpakApi.c @@ -128,10 +128,12 @@ static int CheckDspReset( DSP_ADDRESS IfBlockPntr; /* Interface Block pointer */ DSP_WORD DspStatus; /* DSP Status */ DSP_WORD DspChannels; /* number of DSP channels */ + DSP_WORD Temp[2]; +#if 0 DSP_WORD DspConfs; /* number of DSP conferences */ DSP_ADDRESS PktBufrMem; /* address of Packet Buffer */ - DSP_WORD Temp[2]; unsigned short int i; /* loop index / counter */ +#endif /* Read the pointer to the Interface Block. */ gpakReadDspMemory(DspId, DSP_IFBLK_ADDRESS, 2, Temp); @@ -897,7 +899,9 @@ gpakReadEventFIFOMessageStat_t gpakReadEventFIFOMessage( DSP_WORD TakeIndex; /* event fifo take index */ DSP_WORD WordsReady; /* number words ready for read out of event fifo */ DSP_WORD EventError; /* flag indicating error with event fifo msg */ +#if 0 DSP_WORD *pDebugData; /* debug data buffer pointer in event data struct */ +#endif /* Make sure the DSP Id is valid. */ if (DspId >= MAX_DSP_CORES) diff --git a/wctdm24xxp/base.c b/wctdm24xxp/base.c index 5a63894..0d04d7f 100644 --- a/wctdm24xxp/base.c +++ b/wctdm24xxp/base.c @@ -264,6 +264,8 @@ static char *opermode = "FCC"; static int fxshonormode = 0; static int alawoverride = 0; static int fxo_addrs[4] = { 0x00, 0x08, 0x04, 0x0c }; +static int ringdebounce = DEFAULT_RING_DEBOUNCE; +static int fwringdetect = 0; #ifdef VPM_SUPPORT static int vpmsupport = 1; static int vpmdtmfsupport = 0; @@ -1216,30 +1218,56 @@ static inline void wctdm_voicedaa_check_hook(struct wctdm *wc, int card) wctdm_setreg_intr(wc, card, 5, 0x8); } if (!wc->mods[card].fxo.offhook) { - res = wc->cmdq[card].isrshadow[0]; /* Hook/Ring state */ - if ((res & 0x60) && wc->mods[card].fxo.battery) { - wc->mods[card].fxo.ringdebounce += (ZT_CHUNKSIZE * 4); - if (wc->mods[card].fxo.ringdebounce >= ZT_CHUNKSIZE * RING_DEBOUNCE) { - if (!wc->mods[card].fxo.wasringing) { - wc->mods[card].fxo.wasringing = 1; - zt_hooksig(&wc->chans[card], ZT_RXSIG_RING); - if (debug & DEBUG_CARD) - printk("RING on %d/%d!\n", wc->span.spanno, card + 1); + if (fwringdetect) { + res = wc->cmdq[card].isrshadow[0] & 0x60; + if (wc->mods[card].fxo.ringdebounce--) { + if (res && (res != wc->mods[card].fxo.lastrdtx) && wc->mods[card].fxo.battery) { + if (!wc->mods[card].fxo.wasringing) { + wc->mods[card].fxo.wasringing = 1; + if (debug) + printk("RING on %d/%d!\n", wc->span.spanno, card + 1); + zt_hooksig(&wc->chans[card], ZT_RXSIG_RING); + } + wc->mods[card].fxo.lastrdtx = res; + wc->mods[card].fxo.ringdebounce = 10; + } else if (!res) { + if ((wc->mods[card].fxo.ringdebounce == 0) && wc->mods[card].fxo.wasringing) { + wc->mods[card].fxo.wasringing = 0; + if (debug) + printk("NO RING on %d/%d!\n", wc->span.spanno, card + 1); + zt_hooksig(&wc->chans[card], ZT_RXSIG_OFFHOOK); + } } - wc->mods[card].fxo.ringdebounce = ZT_CHUNKSIZE * RING_DEBOUNCE; + } else if (res && wc->mods[card].fxo.battery) { + wc->mods[card].fxo.lastrdtx = res; + wc->mods[card].fxo.ringdebounce = 10; } } else { - wc->mods[card].fxo.ringdebounce -= ZT_CHUNKSIZE; - if (wc->mods[card].fxo.ringdebounce <= 0) { - if (wc->mods[card].fxo.wasringing) { - wc->mods[card].fxo.wasringing = 0; - zt_hooksig(&wc->chans[card], ZT_RXSIG_OFFHOOK); - if (debug & DEBUG_CARD) - printk("NO RING on %d/%d!\n", wc->span.spanno, card + 1); + res = wc->cmdq[card].isrshadow[0]; + if ((res & 0x60) && wc->mods[card].fxo.battery) { + wc->mods[card].fxo.ringdebounce += (ZT_CHUNKSIZE * 16); + if (wc->mods[card].fxo.ringdebounce >= ZT_CHUNKSIZE * ringdebounce) { + if (!wc->mods[card].fxo.wasringing) { + wc->mods[card].fxo.wasringing = 1; + zt_hooksig(&wc->chans[card], ZT_RXSIG_RING); + if (debug) + printk("RING on %d/%d!\n", wc->span.spanno, card + 1); + } + wc->mods[card].fxo.ringdebounce = ZT_CHUNKSIZE * ringdebounce; } - wc->mods[card].fxo.ringdebounce = 0; + } else { + wc->mods[card].fxo.ringdebounce -= ZT_CHUNKSIZE * 4; + if (wc->mods[card].fxo.ringdebounce <= 0) { + if (wc->mods[card].fxo.wasringing) { + wc->mods[card].fxo.wasringing = 0; + zt_hooksig(&wc->chans[card], ZT_RXSIG_OFFHOOK); + if (debug) + printk("NO RING on %d/%d!\n", wc->span.spanno, card + 1); + } + wc->mods[card].fxo.ringdebounce = 0; + } + } - } } b = wc->cmdq[card].isrshadow[1]; /* Voltage */ @@ -1929,6 +1957,16 @@ static int wctdm_init_voicedaa(struct wctdm *wc, int card, int fast, int manual, reg16 |= (fxo_modes[_opermode].rz << 1); reg16 |= (fxo_modes[_opermode].rt); wctdm_setreg(wc, card, 16, reg16); + + if(fwringdetect) { + /* Enable ring detector full-wave rectifier mode */ + wctdm_setreg(wc, card, 18, 2); + wctdm_setreg(wc, card, 24, 0); + } else { + /* Set to the device defaults */ + wctdm_setreg(wc, card, 18, 0); + wctdm_setreg(wc, card, 24, 0x19); + } /* Set DC Termination: Tip/Ring voltage adjust, minimum operational current, current limitation */ @@ -3703,6 +3741,8 @@ module_param(fxshonormode, int, 0600); module_param(battdebounce, int, 0600); module_param(battthresh, int, 0600); module_param(alawoverride, int, 0600); +module_param(ringdebounce, int, 0600); +module_param(fwringdetect, int, 0600); #ifdef VPM_SUPPORT module_param(vpmsupport, int, 0600); module_param(vpmdtmfsupport, int, 0600); @@ -3725,6 +3765,8 @@ MODULE_PARM(fxshonormode, "i"); MODULE_PARM(battdebounce, "i"); MODULE_PARM(battthresh, "i"); MODULE_PARM(alawoverride, "i"); +MODULE_PARM(ringdebounce, "i"); +MODULE_PARM(fwringdetect, "i"); #ifdef VPM_SUPPORT MODULE_PARM(vpmsupport, "i"); MODULE_PARM(vpmdtmfsupport, "i"); diff --git a/wctdm24xxp/wctdm24xxp.h b/wctdm24xxp/wctdm24xxp.h index c5d6042..143ff60 100644 --- a/wctdm24xxp/wctdm24xxp.h +++ b/wctdm24xxp/wctdm24xxp.h @@ -31,7 +31,13 @@ #define WC_MAX_IFACES 128 -#define RING_DEBOUNCE 128 /* Ringer Debounce (in ms) */ +/*! + * \brief Default ringer debounce (in ms) + * + * \todo This value differs from that in wctdm. In that module, it is 64 ms + * instead of 128 ms. Which one is more appropriate? + */ +#define DEFAULT_RING_DEBOUNCE 128 #define DEFAULT_BATT_DEBOUNCE 64 /* Battery debounce (in ms) */ #define POLARITY_DEBOUNCE 64 /* Polarity debounce (in ms) */ #define DEFAULT_BATT_THRESH 3 /* Anything under this is "no battery" */ @@ -191,6 +197,7 @@ struct wctdm { union { struct { int wasringing; + int lastrdtx; int ringdebounce; int offhook; int battdebounce; |