Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Lee Revell <rlrevell@joe-job.com>
Cc: alsa-devel@lists.sourceforge.net
Subject: Re: Driver design question
Date: Wed, 04 Oct 2006 11:17:11 +0200	[thread overview]
Message-ID: <s5hodssl9t4.wl%tiwai@suse.de> (raw)
In-Reply-To: <1159889722.20801.59.camel@mindpipe>

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

  reply	other threads:[~2006-10-04  9:17 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-14 11:29 Driver design question Takashi Iwai
2006-09-15 14:47 ` Lee Revell
2006-09-19 15:15   ` Takashi Iwai
2006-09-25 19:54     ` Lee Revell
2006-09-27 17:18       ` Takashi Iwai
2006-09-27 17:38         ` Lee Revell
2006-09-30  2:03         ` Lee Revell
2006-10-03 15:35           ` Lee Revell
2006-10-04  9:17             ` Takashi Iwai [this message]
2006-10-19 22:12               ` Lee Revell
2006-10-20 12:55                 ` Takashi Iwai
2006-10-20 20:12                   ` Lee Revell
2006-10-23 13:09                     ` Takashi Iwai
2006-10-23 17:46                       ` Lee Revell
2006-10-24 15:01                         ` Takashi Iwai
2006-10-24 15:30                           ` Lee Revell
2006-10-24 23:54                           ` Lee Revell
2006-10-04  9:07           ` Takashi Iwai
2006-09-27 13:58     ` Lee Revell
2006-09-27 16:52       ` Takashi Iwai
  -- strict thread matches above, loose matches on Subject: below --
2006-09-12 20:27 Lee Revell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=s5hodssl9t4.wl%tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@lists.sourceforge.net \
    --cc=rlrevell@joe-job.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox