summaryrefslogtreecommitdiff
path: root/zaptel.c
diff options
context:
space:
mode:
authormarkster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2004-03-19 04:03:05 +0000
committermarkster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2004-03-19 04:03:05 +0000
commit5704d6f9a25a86b04569f943be1469e11aceb0f8 (patch)
tree881630c9bf4beef730dac9af02c42998caf463a5 /zaptel.c
parentff716f29298df0a0e69c44402fb1f3b57a3eaede (diff)
Add timer PING/PONG
git-svn-id: http://svn.digium.com/svn/zaptel/trunk@326 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'zaptel.c')
-rwxr-xr-xzaptel.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/zaptel.c b/zaptel.c
index 1b7c392..c9b9fa2 100755
--- a/zaptel.c
+++ b/zaptel.c
@@ -289,6 +289,7 @@ static inline void zt_kernel_fpu_begin(void)
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 @@ static int zt_timer_ioctl(struct inode *node, struct file *file, unsigned int cm
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 @@ static unsigned int zt_timer_poll(struct file *file, struct poll_table_struct *w
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