DMA circular buffers - little help wanted

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I'm trying to write a sound card driver and need a bit of help understanding the logic behind the DMA circular buffers.

I can understand there is a buffer of runtime->buffer_size frames, with two pointers: runtime->control->appl_ptr and runtime->status->hw_ptr pointing into it (they are actually offsets from the buffer start). One pointer is the producer, the other consumer. So far a standard circular buffer as I know it. Please correct me if I'm wrong.

But what is runtime->boundary good for? It seems the arithmetics is not module buffer_size but modulo boundary, which is pretty confusing me. According to the code and comments some values (like buffer "pointers", available space, free, space, etc.) are supposed to be within 0 ... boundary - 1 and some within 0 ... buffer_size - 1. Not clear to me what is what and why.

Could someone please help me to understand the logic behind?

The other thing I would like to understand, how is the data positioned in time in terms of synchronisation? I mean where in the buffer, relative to the hw_ptr, is the frame that is supposed to play "now", for an arbitrary "now".

Thanks
Petr

_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux