All of lore.kernel.org
 help / color / mirror / Atom feed
From: Timur Tabi <timur@freescale.com>
To: alsa-devel@alsa-project.org
Subject: Difference between substream->dma_buffer and substream->runtime->dma_buffer_p?
Date: Thu, 14 Jun 2007 17:47:58 -0500	[thread overview]
Message-ID: <4671C59E.70407@freescale.com> (raw)

The snd_pcm_substream structure has a snd_dma_buffer structure.  snd_dma_buffer looks like 
this:

struct snd_dma_buffer {
	struct snd_dma_device dev;	/* device type */
	unsigned char *area;	/* virtual pointer */
	dma_addr_t addr;	/* physical address */
	size_t bytes;		/* buffer size in bytes */
	void *private_data;	/* private for allocator; don't touch */
};

snd_pcm_substream also has a snd_pcm_runtime structure, which looks like this:

struct snd_pcm_runtime {
...

	/* -- DMA -- */
	unsigned char *dma_area;	/* DMA area */
	dma_addr_t dma_addr;		/* physical bus address (not accessible from main CPU) */
	size_t dma_bytes;		/* size of DMA area */

	struct snd_dma_buffer *dma_buffer_p;	/* allocated buffer */


Why the redundancy?  Not only does snd_pcm_runtime have dma_area, dma_addr, and dma_bytes, 
but it also has a pointer to a dns_dma_buffer structure, which also has this information!

So given a snd_pcm_substream structure, you can obtain the physical address of the DMA 
buffer three ways:

substream->dma_buffer.addr
substream->runtime->dma_addr
substream->runtime->dma_buffer_p->addr

When will these three variable contain different values?  If the answer is never, then why 
do they all exist?

-- 
Timur Tabi
Linux Kernel Developer @ Freescale

             reply	other threads:[~2007-06-14 22:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-14 22:47 Timur Tabi [this message]
2007-06-15  7:47 ` Difference between substream->dma_buffer and substream->runtime->dma_buffer_p? Nobin Mathew
2007-06-19 10:34 ` Takashi Iwai

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=4671C59E.70407@freescale.com \
    --to=timur@freescale.com \
    --cc=alsa-devel@alsa-project.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.