summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarkster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2004-06-29 04:27:14 +0000
committermarkster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2004-06-29 04:27:14 +0000
commit19b6e02ceaa74830357aa8b47f97cbd1707e573d (patch)
tree998a09bd1127f6e494cfd0b046089439789e0698
parent045580fe74b31768c97a2e2b772c5ba843fa0d6a (diff)
Add signalling freeze/unfreeze ioctl (and get)
git-svn-id: http://svn.digium.com/svn/zaptel/trunk@427 5390a7c7-147a-4af0-8ec9-7488f05a26cb
-rwxr-xr-xzaptel.c25
-rwxr-xr-xzaptel.h9
2 files changed, 32 insertions, 2 deletions
diff --git a/zaptel.c b/zaptel.c
index 5230bf4..b12229b 100755
--- a/zaptel.c
+++ b/zaptel.c
@@ -926,7 +926,7 @@ static void close_channel(struct zt_chan *chan)
chan->txgain = defgain;
chan->gainalloc = 0;
chan->eventinidx = chan->eventoutidx = 0;
- chan->flags &= ~(ZT_FLAG_LINEAR | ZT_FLAG_PPP);
+ chan->flags &= ~(ZT_FLAG_LINEAR | ZT_FLAG_PPP | ZT_FLAG_SIGFREEZE);
zt_set_law(chan,0);
@@ -3722,6 +3722,25 @@ static int zt_chan_ioctl(struct inode *inode, struct file *file, unsigned int cm
return -ENOSYS;
switch(cmd) {
+ case ZT_SIGFREEZE:
+ get_user(j, (int *)data);
+ spin_lock_irqsave(&chan->lock, flags);
+ if (j) {
+ chan->flags |= ZT_FLAG_SIGFREEZE;
+ } else {
+ chan->flags &= ~ZT_FLAG_SIGFREEZE;
+ }
+ spin_unlock_irqrestore(&chan->lock, flags);
+ break;
+ case ZT_GETSIGFREEZE:
+ spin_lock_irqsave(&chan->lock, flags);
+ if (chan->flags & ZT_FLAG_SIGFREEZE)
+ j = 1;
+ else
+ j = 0;
+ spin_unlock_irqrestore(&chan->lock, flags);
+ put_user(j, (int *)data);
+ break;
case ZT_AUDIOMODE:
/* Only literal clear channels can be put in */
if (chan->sig != ZT_SIG_CLEAR) return (-EINVAL);
@@ -4820,6 +4839,8 @@ static void __zt_hooksig_pvt(struct zt_chan *chan, zt_rxsig_t rxsig)
called with chan->lock held */
if ((chan->rxhooksig) == rxsig) return;
+
+ if ((chan->flags & ZT_FLAG_SIGFREEZE)) return;
chan->rxhooksig = rxsig;
switch(chan->sig) {
@@ -4939,6 +4960,8 @@ void zt_rbsbits(struct zt_chan *chan, int cursig)
if (cursig == chan->rxsig)
return;
+ if ((chan->flags & ZT_FLAG_SIGFREEZE)) return;
+
spin_lock_irqsave(&chan->lock, flags);
switch(chan->sig) {
case ZT_SIG_FXOGS: /* FXO Groundstart */
diff --git a/zaptel.h b/zaptel.h
index 76a92d7..8e5ea65 100755
--- a/zaptel.h
+++ b/zaptel.h
@@ -569,7 +569,7 @@ char dialstr[ZT_MAX_DTMF_BUF];
/*
* Queue Ping
*/
-#define ZT_TIMERPING _IOW (ZT_CODE, 42, int)
+#define ZT_TIMERPING _IOW (ZT_CODE, 42, int) /* Should be 52, but works */
/*
* Acknowledge ping
@@ -577,6 +577,12 @@ char dialstr[ZT_MAX_DTMF_BUF];
#define ZT_TIMERPONG _IOW (ZT_CODE, 53, int)
/*
+ * Set/get signalling freeze
+ */
+#define ZT_SIGFREEZE _IOW (ZT_CODE, 54, int)
+#define ZT_GETSIGFREEZE _IOR (ZT_CODE, 55, int)
+
+/*
* 60-80 are reserved for private drivers
* 80-85 are reserved for dynamic span stuff
*/
@@ -1137,6 +1143,7 @@ typedef enum {
#define ZT_FLAG_LINEAR (1 << 13) /* Talk to user space in linear */
#define ZT_FLAG_PPP (1 << 14) /* PPP is available */
#define ZT_FLAG_T1PPP (1 << 15)
+#define ZT_FLAG_SIGFREEZE (1 << 16) /* Freeze signalling */
struct zt_span {
spinlock_t lock;