diff options
-rwxr-xr-x | zaptel.c | 23 | ||||
-rwxr-xr-x | zaptel.h | 16 |
2 files changed, 38 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 @@ -558,6 +558,16 @@ char dialstr[ZT_MAX_DTMF_BUF]; #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 */ @@ -736,6 +746,12 @@ struct zt_tone_def { /* Structure for zone programming */ /* 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 */ |