From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takashi Iwai Subject: Re: Driver design question Date: Wed, 04 Oct 2006 11:17:11 +0200 Message-ID: References: <45095921020000C80000961F@emea1-mh.id2.novell.com> <1158331680.7948.156.camel@mindpipe> <1159214063.2899.127.camel@mindpipe> <1159581790.7086.141.camel@mindpipe> <1159889722.20801.59.camel@mindpipe> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1159889722.20801.59.camel@mindpipe> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: alsa-devel-bounces@lists.sourceforge.net Errors-To: alsa-devel-bounces@lists.sourceforge.net To: Lee Revell Cc: alsa-devel@lists.sourceforge.net List-Id: alsa-devel@alsa-project.org 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