summaryrefslogtreecommitdiff
path: root/zaptel.c
diff options
context:
space:
mode:
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