At Fri, 25 Jan 2008 17:29:28 +0100, Hermann Lauer wrote:
On Fri, Jan 25, 2008 at 05:19:52PM +0100, Takashi Iwai wrote:
If I interpreted my tests output correctly, the last byte of a period is written by the DMA engine after the interrupt occurs. So the hw pointer probably has to be decremented by one and is then pointing to the last frame (Or even that before: Has the hw pointer to point at the frame which is written at the moment or the one which is guaranteed to be written completely by the hardware ?)
This sounds a bit odd. Isn't it rather the setup of the hardware parameter wrong? I mean, the count calculation in *_prepare() can be the size - 1?
At least according to the datasheet the size calculation is correct. Could you please tell me where the hw pointer exactly should point to ?
The hwptr is the position of the current DMA. The data below that point must have been already processed. That's why hwptr returned in snd_pcm_period_elapsed() must be on the period boundary or above.
OTOH, it doesn't matter much whether the data above hwptr has been processed or not, e.g. a sloppy pointer callback.
Takashi