alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* How does struct snd_pcm_hardware relate to the actual hardware
@ 2010-06-30 21:32 Adam Rosenberg
  2010-07-01 18:40 ` Mark Brown
  0 siblings, 1 reply; 3+ messages in thread
From: Adam Rosenberg @ 2010-06-30 21:32 UTC (permalink / raw)
  To: alsa-devel; +Cc: Mark Brown, Liam Girdwood

I am using DMA to transfer data to SPORT1 on my Blackfin BF537.  I am
using a CS42448 CODEC that has 8 DACs.  I am using TDM mode and have
set the following:

DMA Buffer Size For Each SPORT Data Line (Rx or Tx) = 131072 bytes
DMA Periods = 8

static struct snd_pcm_hardware snd_pcm_hw =
{
	.info = (SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER |
SNDRV_PCM_INFO_RESUME),
	.formats = SNDRV_PCM_FMTBIT_S32_LE,
	.rates = SNDRV_PCM_RATE_48000,
	.rate_min = 48000,
	.rate_max = 48000,
	.buffer_bytes_max = 32768,
	.channels_min = 2,
	.channels_max = 2,
	.period_bytes_min = 8,
	.period_bytes_max = 4096,
	.periods_min = 8,
	.periods_max = 8,
};

Everytime I receive a DMA interrupt from the SPORT driver I call
snd_pcm_period_elapsed for all of the substreams that are currently
active.  In the PCM Copy callback I calculate the position within the
DMA buffer to write to based on the TDM slot for the channel and the
position passed into the function.

The audio is not being placed into the DMA buffer properly.  The audio
plays faster than it should and has a constant stutter.  I have read
the "writing an ALSA driver" guide multiple times but it does not
explain the relationship between struct snd_pcm_hardware,
snd_pcm_period_elapsed, and the copy callback clearly enough for me to
understand what I am doing wrong.

Please explain how these interact in more detail to help me fix this
problem.  I can also send the full source code to the CS42448 driver I
am working on if more details are needed.

Thank you,
Adam

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-07-12 20:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-30 21:32 How does struct snd_pcm_hardware relate to the actual hardware Adam Rosenberg
2010-07-01 18:40 ` Mark Brown
2010-07-12 20:35   ` Adam Rosenberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).