Re: Driver design question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



At Tue, 03 Oct 2006 11:35:22 -0400,
Lee Revell wrote:
> 
> On Fri, 2006-09-29 at 22:03 -0400, Lee Revell wrote:
> > pcm-indirect.h:
> > 
> >  90  */
> >  91 static inline snd_pcm_uframes_t
> >  92 snd_pcm_indirect_playback_pointer(snd_pcm_substream_t *substream,
> >  93                                   snd_pcm_indirect_t *rec,
> > unsigned int ptr)
> >  94 {
> > 
> > [ ... ]
> > 
> > 103         if (substream->ops->ack)
> > 104                 substream->ops->ack(substream);
> > 
> > But, this cannot work with our hardware, if the ack callback always
> > transfers 0x2000 words from the hardware, because the pointer callback
> > is invoked many times per period.
> 
> If the ack callback is called many times per period, but our hardware
> only supports writing in chunks of 0x2000 words, how can we copy to the
> hardware from the ack callback as you recommend without using an
> intermediate buffer?

I thought you don't have to write 0x2000 words at once but in a loop?
Look at dream_playback_copy().  It has bytes argument.  That specifies
the size to copy.  Setting snd_pcm_indirect.hw_buffer_size = 0x4000
should restrict the max size to be written to 0x2000 words.

Even if you have to call xfer_end() at each 0x2000 words, you can
implement a counter and call xfer_end(), such as


static void dream_playback_copy(snd_pcm_substream_t *substream,
                                snd_pcm_indirect_t *rec, size_t bytes)
{
	...
	int words = bytes / 2;

	for (; words > 0; words--) {
       		mpu_write16(dream, *data++);
		playback_chunk_left--;
		if (!playback_chunk_left) {
			xfer_end();
			playback_chunk_left = 0x2000;
		}
	}
}
		

Takashi

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/alsa-devel

[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux