[alsa-devel] ### Question on HW Pointer

Steve Spano steve at fl-eng.com
Wed Oct 6 02:35:15 CEST 2010


Hello Folks,

 

I am wondering if someone can help clarify how the hw pointer is used by the
ALSA layer.

I have a 24 channel soundcard that we have developed, using a Xilinx fpga.

The system is working, in that I can receive inbound samples on all 24
inputs and transmit samples on all 24 outputs.

 

But something isn't completely right.

 

We can xrun's and reports of very high cpu utilization.even though I know we
are in and out of our interrupts within 100uS for a 2.7mS interrupt period.

Interesting that our xruns cite a "0mS delay" or sometimes a 4mS delay (1.5
periods?)

 

I think the issue has to do with how we are presenting the response to the
hw-pointer request OR how/when we are calling the pcm_snd_elapsed.

 

I think the flow should be as follows (lets consider the dac part)

 

Step #1 ) interrupt occurs

Step #2) dma/transfer begins as kicked off in interrupt routine

Step #3) we advance the buffer pointer for the alsa buffer

Step #4) we exit the interrupt

. then the hardware should start advancing its pointer as it is reading the
new samples

.. then sometime later, the alsa layer calls the "hw_pointer" function

And then we return the current value of the hardware pointer from the board?
So alsa knows how many samples the board has processed from the interrupt?

 

We should be pretty close, because it is working for the most part..but I
think this pointer is not right. 

 

Can someone explain how this pointer/etc is supposed to flow and what alsa
may be using it for? Maybe some latency calculation in a an upper layer?

 

Thanks again

 

Steve Spano

 



More information about the Alsa-devel mailing list