LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-20-2008, 03:04 PM   #1
bboyspin
LQ Newbie
 
Registered: Oct 2008
Posts: 4

Rep: Reputation: 0
Thumbs up ALSA Driver question


I have this alsa driver related question (ALSA api)

trigger callback:

static int
snd_ac97_playback_trigger(struct snd_pcm_substream *substream, int cmd)
{
struct audio_stream *stream = substream->private_data;
int err = 0;

switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
// dma start function
break;
case SNDRV_PCM_TRIGGER_STOP:
// dma stop function
break;
default:
err = -EINVAL;
break;
}
return err;
}

when is SNDRV_PCM_TRIGGER_STOP triggered? when device (/dev/dsp) is closed? I'm having problems with understanding how to properly disable
my DMA engine (double buffered). Driver is working just fine except that
at the end, one extra period is played. Today I've discovered a bug in a pointer callback. when fixed, could solve the problem. But my most important question would be: if trigger callback can stop dma engine before another irq would happen? Because I just don't know how to detect last period (last buffer) in my alsa driver. I think that it isn't even possible?

regards,
Bojan M.
 
Old 10-20-2008, 11:06 PM   #2
bboyspin
LQ Newbie
 
Registered: Oct 2008
Posts: 4

Original Poster
Rep: Reputation: 0
anyone here with background in writing alsa drivers?
 
Old 10-21-2008, 04:07 AM   #3
bboyspin
LQ Newbie
 
Registered: Oct 2008
Posts: 4

Original Poster
Rep: Reputation: 0
I think (not 100% sure jet), fix to period callback helped!
And I've found out that "snd_pcm_elapsed" function calls period callback...

r. bojan m.
 
Old 10-21-2008, 09:22 AM   #4
bboyspin
LQ Newbie
 
Registered: Oct 2008
Posts: 4

Original Poster
Rep: Reputation: 0
how can I trigger SNDRV_PCM_TRIGGER_STOP one period earlier?

if I need to play BUF0 and BUF1, I wan't SNDRV_PCM_TRIGGER_STOP to be triggered,
and wait there so that BUF1 would be played, than I would stop dma engine...

now I get this just after BUF1 was played, but then possibly some extra bytes could be played?!

r. bojan m.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ALSA driver problem: Intel HDA card driver Digital Watches Linux - Hardware 8 04-11-2008 07:02 AM
broke gentoo after installing alsa-driver & alsa-utils snakeo2 Linux - Newbie 1 01-26-2006 08:05 AM
alsa-driver-1.0.5.tar.gz or kernel alsa? shanenin Linux - Software 2 05-29-2004 01:47 PM
Alsa Driver in 2.6.0 oopicmaster Linux - General 3 12-26-2003 11:39 AM
one newbie question about Alsa driver captainstorm Linux - Newbie 1 10-15-2003 08:29 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:37 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration