Thanks Clemens
>> is the best method to build a sound card and a capture PCM?
>As compared to what? Any other method will not allow your hardware to
be used for audio recording.
As compared to my driver configuring the DMA to capture the data into a
known buffer, and then directly accessing the buffer to wrap it in a WAV
format. I should have rephrased my initial question as, "my goal is to
simply wrap multichannel digital mic input in WAV format; is ALSA/arecord
the most efficient way to do this?"
>> Most of the tutorials seem to imply an IRQ signals a frame of data has
>> transferred
>No, the DMA interrupt typically signals that a period of data has been
transferred.
OK, so per the alsa wiki
<http://www.alsa-project.org/main/index.php/FramesPeriods>, I should make
my buffer at least 2x the size of a period. I could in theory accept
several frames of data based on my desired period size, fire the IRQ, and
then....? I have a buffer ready, under which function does it get passed
back to the ALSA framework? Ben Collins uses copy_to_user, but I'm keeping
this all in kernel space (or is that wrong?).
The flow I think I need, please correct me if I'm wrong or missing. I can
dump code if it's more helpful:
- Create Card
- Create Device
- Create PCM, 2 channel
- Define hardware, ops, etc.
- preallocate_pages
- register card.
- (arecord is called)
- pcm_trigger_start called
- dma begins transfer (of size #periods in a circular buffer)
- dma completes/fires period-based IRQ
- <<question>> buffer is transferred in function X (?) to Y (?)
- ALSA internally checks if # of periods has been transferred (based on
IRQ count somewhere?)
- pcm_trigger_stop is called, stopping dma
- arecord returns w/ file saved to filesystem
>How exactly does your DMA controller work?
I have a 2 channel digital mic, running at 24bit, 44.1KHz. I've written
FPGA code to buffer it, and write the data into a buffer in DRAM that the
processor has provided. I can configure the number of frames/periods
transferred before I fire an IRQ. It uses a circular buffer descriptor ring.
>(And development questions belong on the alsa-devel list.)
I just requested access to that list, but haven't received approval yet.
Thanks again for all the help!
Rob
On Tue, May 3, 2016 at 1:50 AM, Clemens Ladisch <cladi...@googlemail.com>
wrote:
> Rob Nertney wrote:
> > is the best method to build a sound card and a capture PCM?
>
> As compared to what? Any other method will not allow your hardware to
> be used for audio recording.
>
> > do I copy the DMA buffer address in the TRIGGER case statements?
>
> Your trigger callback is responsible for starting and stopping the DMA;
> nothing else.
>
> > I'm not sure where to do the framing of the data.
>
> This is done by the hardware. Your driver just describes the format of
> the data.
>
> > Most of the tutorials seem to imply an IRQ signals a frame of data has
> > transferred
>
> No, the DMA interrupt typically signals that a period of data has been
> transferred.
>
> How exactly does your DMA controller work?
>
>
> (And development questions belong on the alsa-devel list.)
>
>
> Regards,
> Clemens
>
------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
Alsa-user mailing list
Alsa-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/alsa-user