Update of /cvsroot/alsa/alsa-kernel/core
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31427/core
Modified Files:
timer.c
Log Message:
Added early event flag and code to the timer interface.
Index: timer.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/core/timer.c,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -r1.55 -r1.56
--- timer.c 17 Dec 2003 15:14:33 -0000 1.55
+++ timer.c 6 Apr 2004 17:23:46 -0000 1.56
@@ -1512,7 +1512,6 @@
static int snd_timer_user_params(struct file *file, snd_timer_params_t *_params)
{
- unsigned long flags;
snd_timer_user_t *tu;
snd_timer_params_t params;
snd_timer_t *t;
@@ -1548,18 +1547,17 @@
goto _end;
}
snd_timer_stop(tu->timeri);
- spin_lock_irqsave(&t->lock, flags);
- if (params.flags & SNDRV_TIMER_PSFLG_AUTO) {
+ spin_lock_irq(&t->lock);
+ tu->timeri->flags &= ~(SNDRV_TIMER_IFLG_AUTO|
+ SNDRV_TIMER_IFLG_EXCLUSIVE|
+ SNDRV_TIMER_IFLG_EARLY_EVENT);
+ if (params.flags & SNDRV_TIMER_PSFLG_AUTO)
tu->timeri->flags |= SNDRV_TIMER_IFLG_AUTO;
- } else {
- tu->timeri->flags &= ~SNDRV_TIMER_IFLG_AUTO;
- }
- if (params.flags & SNDRV_TIMER_PSFLG_EXCLUSIVE) {
+ if (params.flags & SNDRV_TIMER_PSFLG_EXCLUSIVE)
tu->timeri->flags |= SNDRV_TIMER_IFLG_EXCLUSIVE;
- } else {
- tu->timeri->flags &= ~SNDRV_TIMER_IFLG_EXCLUSIVE;
- }
- spin_unlock_irqrestore(&t->lock, flags);
+ if (params.flags & SNDRV_TIMER_PSFLG_EARLY_EVENT)
+ tu->timeri->flags |= SNDRV_TIMER_IFLG_EARLY_EVENT;
+ spin_unlock_irq(&t->lock);
if (params.queue_size > 0 && (unsigned int)tu->queue_size !=
params.queue_size) {
if (tu->tread) {
ttr = (snd_timer_tread_t *)kmalloc(params.queue_size *
sizeof(snd_timer_tread_t), GFP_KERNEL);
@@ -1577,6 +1575,24 @@
}
}
}
+ tu->qhead = tu->qtail = tu->qused = 0;
+ if (tu->timeri->flags & SNDRV_TIMER_IFLG_EARLY_EVENT) {
+ if (tu->tread) {
+ snd_timer_tread_t tread;
+ tread.event = SNDRV_TIMER_EVENT_EARLY;
+ tread.tstamp.tv_sec = 0;
+ tread.tstamp.tv_nsec = 0;
+ tread.val = 0;
+ snd_timer_user_append_to_tqueue(tu, &tread);
+ } else {
+ snd_timer_read_t *r = &tu->queue[0];
+ r->resolution = 0;
+ r->ticks = 0;
+ tu->qused++;
+ tu->qtail++;
+ }
+
+ }
tu->filter = params.filter;
tu->ticks = params.ticks;
err = 0;
@@ -1588,7 +1604,6 @@
static int snd_timer_user_status(struct file *file, snd_timer_status_t *_status)
{
- unsigned long flags;
snd_timer_user_t *tu;
snd_timer_status_t status;
@@ -1599,9 +1614,9 @@
status.resolution = snd_timer_resolution(tu->timeri);
status.lost = tu->timeri->lost;
status.overrun = tu->overrun;
- spin_lock_irqsave(&tu->qlock, flags);
+ spin_lock_irq(&tu->qlock);
status.queue = tu->qused;
- spin_unlock_irqrestore(&tu->qlock, flags);
+ spin_unlock_irq(&tu->qlock);
if (copy_to_user(_status, &status, sizeof(status)))
return -EFAULT;
return 0;
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
Alsa-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-cvslog