On Tue, Jul 02, 2013 at 07:50:16AM +0200, Mike Looijmans wrote:
On 07/02/2013 05:33 AM, Joel Fernandes wrote:
But even with much lower loads, I got underruns when recording to SD card that I couldn't really explain. I noticed that the SD transfers took up a lot of DMA params (about 40), so maybe that was just causing too much work for the IRQ or DMA handler routines.
SD cards are generally just slow, it's possible it's just not able to keep up with the data you're throwing at it. Things like batching the writes up into large chunks can help here but you may just be hitting a genuine limit if you need to record for too long and don't have enough fast storage (like RAM) to buffer.
This meant I had to use a DMA PARAM slot for every "period". The OMAP L138 has 128 of those slots, so it's no problem to use a bunch of them. Because the chain is cyclic, there is no need to update any DMA parameter while running. All that ALSA needs to do is empty the buffer before the cycle completes and the current position gets overwritten.
This sort of cyclic thing tends to be best, ideally you don't need interrupts at all (other than a timer).