diff options
author | markster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2004-03-19 04:03:05 +0000 |
---|---|---|
committer | markster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2004-03-19 04:03:05 +0000 |
commit | 5704d6f9a25a86b04569f943be1469e11aceb0f8 (patch) | |
tree | 881630c9bf4beef730dac9af02c42998caf463a5 /zaptel.c | |
parent | ff716f29298df0a0e69c44402fb1f3b57a3eaede (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-x | zaptel.c | 23 |
1 files changed, 22 insertions, 1 deletions
@@ -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 |