From: James Courtier-Dutton <James@superbug.co.uk>
To: Adrian McMenamin <adrian@mcmen.demon.co.uk>
Cc: Lee Revell <rlrevell@joe-job.com>,
Alsa-devel <alsa-devel@lists.sourceforge.net>
Subject: Re: pointer callback in pcm
Date: Sat, 11 Mar 2006 18:47:28 +0000 [thread overview]
Message-ID: <44131B40.9080100@superbug.co.uk> (raw)
In-Reply-To: <1142098225.9496.25.camel@localhost.localdomain>
Adrian McMenamin wrote:
> On Sat, 2006-03-11 at 15:42 +0000, James Courtier-Dutton wrote:
>
>
>
>> 2) start DMA transfer of one period.
>> Which period you copy is the important bit here. At this point the
>> hardware will have played 1 period, so you replace the period that has
>> just played, not the period that is about to be played.
>>
>
> I am just sitting down to write this code now, but where in the dma
> buffer should I look for this period. The relevant code at the moment
> looks like this:
>
> dma_xfer(0, runtime->dma_area + (0x1000 * dreamcastcard->clicks),
> 0x11000 + (0x1000 * dreamcastcard->clicks), 0x1000, 5);
>
>
> (clicks is always equal to the period that has just played out ie the
> code does this
>
> Get interrupt
> Reset interrupt flag on ARM7 side
> dma transfer
> clicks++
> if (clicks == 8) clicks = 0
> call pcm_elapsed
> return with acknowledge interrupt
>
>
> The hardware buffer begins at 0x11000 in the ARM7 space and each period
> is 0x1000 in size - but I am rather assuming you can rely on the DMA
> buffer (8 periods long) being filled up at 8 period intervals -is that
> right?
>
>
>
Ok, I looked at the code now, and there are a few things that need fixing.
1)
static snd_pcm_hardware_t snd_pcm_aica_playback_hw = {
.info = (SNDRV_PCM_INFO_NONINTERLEAVED),
.formats = (SNDRV_PCM_FMTBIT_S8|SNDRV_PCM_FMTBIT_U8|SNDRV_PCM_FMTBIT_S16_LE|SNDRV_PCM_FMTBIT_IMA_ADPCM),
.rates = SNDRV_PCM_RATE_8000_48000,
.rate_min = 8000,
.rate_max = 48000,
.channels_min = 1,
.channels_max = 1,
.buffer_bytes_max = 32768,
.period_bytes_min = 4096,
.period_bytes_max = 4096,
.periods_min = 1,
.periods_max = 8,
};
If the card can only do 8 periods, make .periods_min = 8,
Can the card handle all these formats and rates in hardware.
Is it really only a mono sound channel?
You will need to set the .buffer_bytes_min as well.
2)
static snd_pcm_uframes_t snd_aicapcm_pcm_pointer(snd_pcm_substream_t
*substream)
{
return readl(0xa0810004 + 4);
}
What sort of values should this return during playback?
Add a printk to log some of them.
The value should be in "frames" and not "bytes"
Use the ALSA function bytes_to_frames(runtime, value) to automatically
do the adjustments from bytes to frames.
If the returned value is just period number, then you will have to
multiply it up to the "frames" scale.
In case you missed it in the docs. "Frames" are units of samples
equivalent to all the bytes needed to play one PCM sample in all channels.
E.g. 16 bit Stereo sound takes 4 bytes per sample for all channels. This
equals 1 frame.
16 bit mono takes 2 bytes per sample for all channels. This equals 1 frame.
James
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
next prev parent reply other threads:[~2006-03-11 18:47 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-09 22:21 pointer callback in pcm Adrian McMenamin
2006-03-10 0:53 ` Lee Revell
2006-03-10 19:51 ` Adrian McMenamin
2006-03-10 20:16 ` Takashi Iwai
2006-03-10 20:21 ` Adrian McMenamin
2006-03-10 20:23 ` Lee Revell
2006-03-11 11:16 ` James Courtier-Dutton
2006-03-11 11:27 ` Adrian McMenamin
2006-03-11 15:42 ` James Courtier-Dutton
2006-03-11 15:53 ` Adrian McMenamin
2006-03-11 17:30 ` Adrian McMenamin
2006-03-11 18:47 ` James Courtier-Dutton [this message]
2006-03-11 19:08 ` Adrian McMenamin
2006-03-11 19:15 ` James Courtier-Dutton
2006-03-11 19:18 ` Adrian McMenamin
2006-03-11 19:37 ` James Courtier-Dutton
2006-03-11 19:55 ` Adrian McMenamin
2006-03-11 19:26 ` Adrian McMenamin
2006-03-11 19:35 ` James Courtier-Dutton
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=44131B40.9080100@superbug.co.uk \
--to=james@superbug.co.uk \
--cc=adrian@mcmen.demon.co.uk \
--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 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.