[Asterisk-cvs] zaptel zaptel.c,1.61,1.62 zaptel.h,1.28,1.29
markster at lists.digium.com
markster at lists.digium.com
Thu Mar 18 23:07:55 CST 2004
Update of /usr/cvsroot/zaptel
In directory mongoose.digium.com:/tmp/cvs-serv2203
Modified Files:
zaptel.c zaptel.h
Log Message:
Add timer PING/PONG
Index: zaptel.c
===================================================================
RCS file: /usr/cvsroot/zaptel/zaptel.c,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -d -r1.61 -r1.62
--- zaptel.c 5 Mar 2004 17:46:18 -0000 1.61
+++ zaptel.c 19 Mar 2004 04:03:05 -0000 1.62
@@ -289,6 +289,7 @@
static struct zt_timer {
int ms; /* Countdown */
int pos; /* Position */
+ int ping; /* Whether we've been ping'd */
int tripped; /* Whether we're tripped */
struct zt_timer *next; /* Linked list */
wait_queue_head_t sel;
@@ -2552,6 +2553,26 @@
timer->tripped -= j;
spin_unlock_irqrestore(&zaptimerlock, flags);
break;
+ case ZT_GETEVENT: /* Get event on queue */
+ spin_lock_irqsave(&zaptimerlock, flags);
+ /* set up for no event */
+ put_user(ZT_EVENT_NONE,(int *)data);
+ if (timer->tripped)
+ put_user(ZT_EVENT_TIMER_EXPIRED, (int *)data);
+ if (timer->ping)
+ put_user(ZT_EVENT_TIMER_PING, (int *)data);
+ spin_unlock_irqrestore(&zaptimerlock, flags);
+ break;
+ case ZT_TIMERPING:
+ spin_lock_irqsave(&zaptimerlock, flags);
+ timer->ping = 1;
+ spin_unlock_irqrestore(&zaptimerlock, flags);
+ break;
+ case ZT_TIMERPONG:
+ spin_lock_irqsave(&zaptimerlock, flags);
+ timer->ping = 0;
+ spin_unlock_irqrestore(&zaptimerlock, flags);
+ break;
default:
return -ENOTTY;
}
@@ -5508,7 +5529,7 @@
if (timer) {
poll_wait(file, &timer->sel, wait_table);
spin_lock_irqsave(&zaptimerlock, flags);
- if (timer->tripped)
+ if (timer->tripped || timer->ping)
ret |= POLLPRI;
spin_unlock_irqrestore(&zaptimerlock, flags);
} else
Index: zaptel.h
===================================================================
RCS file: /usr/cvsroot/zaptel/zaptel.h,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- zaptel.h 15 Feb 2004 02:23:25 -0000 1.28
+++ zaptel.h 19 Mar 2004 04:03:05 -0000 1.29
@@ -558,6 +558,16 @@
#define ZT_ONHOOKTRANSFER _IOW (ZT_CODE, 51, int)
/*
+ * Queue Ping
+ */
+#define ZT_TIMERPING _IOW (ZT_CODE, 42, int)
+
+/*
+ * Acknowledge ping
+ */
+#define ZT_TIMERPONG _IOW (ZT_CODE, 53, int)
+
+/*
* 60-80 are reserved for private drivers
* 80-85 are reserved for dynamic span stuff
*/
@@ -735,6 +745,12 @@
/* Ret value for the beginning of a pulse coming on its way */
#define ZT_EVENT_PULSE_START 14
+
+/* Timer event -- timer expired */
+#define ZT_EVENT_TIMER_EXPIRED 15
+
+/* Timer event -- ping ready */
+#define ZT_EVENT_TIMER_PING 16
#define ZT_EVENT_PULSEDIGIT (1 << 16) /* This is OR'd with the digit received */
#define ZT_EVENT_DTMFDIGIT (1 << 17) /* Ditto for DTMF */
More information about the svn-commits
mailing list