summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarkster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2002-10-26 18:25:29 +0000
committermarkster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2002-10-26 18:25:29 +0000
commitcd0da1d15c640b4a63fe9e0222b216bebaf0b08f (patch)
treeed59f600653b43faa3ca27800f30c44bc7051e03
parent47031a3ee9bcdcf46c0ace346bc36ce8c6f3e407 (diff)
Version 0.3.2 from FTP
git-svn-id: http://svn.digium.com/svn/zaptel/trunk@123 5390a7c7-147a-4af0-8ec9-7488f05a26cb
-rwxr-xr-xwcfxo.c39
-rwxr-xr-xwcfxs.c2
-rwxr-xr-xwctdm.c2
-rwxr-xr-xztdummy.c2
4 files changed, 39 insertions, 6 deletions
diff --git a/wcfxo.c b/wcfxo.c
index 2d3ee1f..e00f4eb 100755
--- a/wcfxo.c
+++ b/wcfxo.c
@@ -42,6 +42,9 @@
/* #define ENABLE_TASKLETS */
+/* Un-comment the following for POTS line support for Japan */
+/* #define JAPAN */
+
#define WC_MAX_IFACES 128
#define WC_CNTL 0x00
@@ -68,7 +71,12 @@
#define FLAG_READ 2
#define RING_DEBOUNCE 64 /* Ringer Debounce (in ms) */
+#ifdef JAPAN
+#define BATT_DEBOUNCE 30 /* Battery debounce (in ms) */
+#define OH_DEBOUNCE 350 /* Off/On hook debounce (in ms) */
+#else
#define BATT_DEBOUNCE 80 /* Battery debounce (in ms) */
+#endif
#define MINPEGTIME 10 * 8 /* 30 ms peak to peak gets us no more than 100 Hz */
#define PEGTIME 50 * 8 /* 50ms peak to peak gets us rings of 10 Hz or more */
@@ -104,6 +112,10 @@ struct wcfxo {
int pegcount;
int battdebounce;
int nobatttimer;
+ int ringdebounce;
+#ifdef JAPAN
+ int ohdebounce;
+#endif
int allread;
int regoffset; /* How far off our registers are from what we expect */
int alt;
@@ -295,7 +307,10 @@ static inline void wcfxo_receiveprep(struct wcfxo *wc, unsigned char ints)
/* Reset pegcount if our timer expires */
wc->pegcount = 0;
}
- if (!wc->offhook) {
+ /* Decrement debouncer if appropriate */
+ if (wc->ringdebounce)
+ wc->ringdebounce--;
+ if (!wc->offhook && !wc->ringdebounce) {
if (!wc->ring && (wc->pegcount > PEGCOUNT)) {
/* It's ringing */
if (debug)
@@ -393,7 +408,10 @@ static void wcfxo_interrupt(int irq, void *dev_id, struct pt_regs *regs)
if (debug)
printk("NO BATTERY!\n");
wc->battery = 0;
- zt_hooksig(&wc->chan, ZT_RXSIG_ONHOOK);
+#ifdef JAPAN
+ if ((!wc->ohdebounce) && wc->offhook)
+#endif
+ zt_hooksig(&wc->chan, ZT_RXSIG_ONHOOK);
wc->battdebounce = BATT_DEBOUNCE;
} else if (!wc->battery)
wc->battdebounce = BATT_DEBOUNCE;
@@ -423,6 +441,11 @@ static void wcfxo_interrupt(int irq, void *dev_id, struct pt_regs *regs)
if (wc->battdebounce)
wc->battdebounce--;
+#ifdef JAPAN
+ if (wc->ohdebounce)
+ wc->ohdebounce--;
+#endif
+
}
}
@@ -477,6 +500,11 @@ static int wcfxo_hooksig(struct zt_chan *chan, zt_txsig_t txsig)
reg = reg | 0x1;
wcfxo_setreg(wc, 0x5, reg);
wc->offhook = 1;
+#ifdef JAPAN
+ wc->battery = 1;
+ wc->battdebounce = BATT_DEBOUNCE;
+ wc->ohdebounce = OH_DEBOUNCE;
+#endif
break;
case ZT_TXSIG_ONHOOK:
/* Put on hook and enable on hook line monitor */
@@ -486,6 +514,11 @@ static int wcfxo_hooksig(struct zt_chan *chan, zt_txsig_t txsig)
reg = reg | 0x08;
wcfxo_setreg(wc, 0x5, reg);
wc->offhook = 0;
+ /* Don't accept a ring for another 1000 ms */
+ wc->ringdebounce = 1000;
+#ifdef JAPAN
+ wc->ohdebounce = OH_DEBOUNCE;
+#endif
break;
default:
printk("wcfxo: Can't set tx state to %d\n", txsig);
@@ -499,7 +532,7 @@ static int wcfxo_initialize(struct wcfxo *wc)
{
/* Zapata stuff */
sprintf(wc->span.name, "WCFXO/%d", wc->pos);
- sprintf(wc->span.desc, "%s Board %d\n", wc->variety, wc->pos + 1);
+ sprintf(wc->span.desc, "%s Board %d", wc->variety, wc->pos + 1);
sprintf(wc->chan.name, "WCFXO/%d/%d", wc->pos, 0);
wc->chan.sigcap = ZT_SIG_FXSKS | ZT_SIG_FXSLS;
wc->chan.chanpos = 1;
diff --git a/wcfxs.c b/wcfxs.c
index 610d038..73f6e32 100755
--- a/wcfxs.c
+++ b/wcfxs.c
@@ -929,7 +929,7 @@ static int wcfxs_initialize(struct wcfxs *wc)
int x;
/* Zapata stuff */
sprintf(wc->span.name, "WCFXS/%d", wc->pos);
- sprintf(wc->span.desc, "%s Board %d\n", wc->variety, wc->pos + 1);
+ sprintf(wc->span.desc, "%s Board %d", wc->variety, wc->pos + 1);
wc->span.deflaw = ZT_LAW_MULAW;
for (x=0;x<wc->cards;x++) {
sprintf(wc->chans[x].name, "WCFXS/%d/%d", wc->pos, x);
diff --git a/wctdm.c b/wctdm.c
index 610d038..73f6e32 100755
--- a/wctdm.c
+++ b/wctdm.c
@@ -929,7 +929,7 @@ static int wcfxs_initialize(struct wcfxs *wc)
int x;
/* Zapata stuff */
sprintf(wc->span.name, "WCFXS/%d", wc->pos);
- sprintf(wc->span.desc, "%s Board %d\n", wc->variety, wc->pos + 1);
+ sprintf(wc->span.desc, "%s Board %d", wc->variety, wc->pos + 1);
wc->span.deflaw = ZT_LAW_MULAW;
for (x=0;x<wc->cards;x++) {
sprintf(wc->chans[x].name, "WCFXS/%d/%d", wc->pos, x);
diff --git a/ztdummy.c b/ztdummy.c
index 021b12d..41024b2 100755
--- a/ztdummy.c
+++ b/ztdummy.c
@@ -96,7 +96,7 @@ static int ztdummy_initialize(struct ztdummy *ztd)
{
/* Zapata stuff */
sprintf(ztd->span.name, "ZTDUMMY/1");
- sprintf(ztd->span.desc, "%s %d\n", ztd->span.name, 1);
+ sprintf(ztd->span.desc, "%s %d", ztd->span.name, 1);
sprintf(ztd->chan.name, "ZTDUMMY/%d/%d", 1, 0);
ztd->chan.chanpos = 1;
ztd->span.chans = &ztd->chan;