Hi Robin,
On Tue, 2008-01-08 at 22:58 -0500, Robin Getz wrote:
OK - I see in:
http://www.alsa-project.org/~tiwai/writing-an-alsa-driver/x1405.htm
I assume that is what you mean?
Exactly, yes.
If so, I'm still confused - since the pcmcia/vx (vxpocket driver) doesn't seem to do that... ??
Hmmm, I never looked at the vxpocket driver ....
I do see the driver in pci/rme32.c - it is using pcm-indirect.h and the snd_pcm_indirect_xxx functions - if that is the one we should be looking at?
Yes. rme32.c is a good example.
My only question is - if you allow a mmaped intermediate buffer, how does the driver notice when ALSA writes into this buffer?
It's the ack() callback. ALSA writes/reads something into/from the intermediate buffer and calls the driver's ack() callback - if there is any. In the ack() callback the driver should call one of the snd_pcm_indirect_*_transfer() functions. There, the difference between current and last seen appl_ptr gives the "new position" of the PCM Layer in your intermediate buffer (where it will write/read next time).
Joachim