[alsa-devel] mapping externally allocated Scatter Gather DMA buffers
abraham.manu at gmail.com
Wed Nov 10 10:40:23 CET 2010
On Wed, Nov 10, 2010 at 12:35 PM, Jaroslav Kysela <perex at perex.cz> wrote:
> On Wed, 10 Nov 2010, Manu Abraham wrote:
>> testbox ~ # arecord -Dplughw:2,0
>> Recording WAVE 'stdin' : Unsigned 8 bit, Rate 8000 Hz, Mono
>> ALSA lib pcm_mmap.c:369:(snd_pcm_mmap) mmap failed: Invalid argument
>> arecord: set_params:1041: Unable to install hw params:
> set_params fails, because snd_pcm_mmap (mmap() syscall) failed for your
> driver. The configuration space for hw_params is now OK.
> You have to check sound/core/pcm_native.c, if snd_pcm_default_mmap() and
> snd_pcm_mmap_data() implementation matches the mmap policy for your DMA
> buffer. You may create your own mmap callback - substream->ops->mmap.
I didn't yet map the buffers, will check it out.
>> bufsiz=31872 periods=83 bytes=384
> This looks correct. Frame (in ALSA meaning) is 2 8-bit unsigned samples (you
> have forced to use 2 channels in your hw->ops). Thus 192 frames is 384 bytes
> for this stream format. Perhaps, your frame is not ALSA frame.
192 came from a mS long capture at 48kHz.
> ALSA frame: channels * sizeof(sample)
>> Now, I wonder what a period really is. I guess I lack the basics here
>> .. A basic explanation to the context,
>> would be quite helpful.
> Period is just a time after which should the driver acknowledge the
> transferred samples. Note that it's preffered to also allow large periods
> (if you can set hw to not acknowledge each DMA block transfer).
Ok, so period should be the interval at which an IRQ is expected.
ie, if i set a buffer size for 40mS, the period should be 40, I guess.
That said, what should be a recommended value for period ? If hardware
needs to generate an IRQ at the end of each period ?
More information about the Alsa-devel