Re: Can DMA address, periods, buffer size, etc change after hw_params is called?

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

 



On Thu, 29 Jan 2009 09:58:10 +0100
Clemens Ladisch <clemens@xxxxxxxxxx> wrote:

> Hans-Christian Egtvedt wrote:
> > Is there a chance that the following might happen:
> >  - stop trigger,
> >  - hw_free
> >  - hw_params
> >  - prepare
> >  - start trigger
> > 
> > I.e. without calling close and open?
> 
> Yes.
> 
> It is also possible that the same happens without hw_free, i.e.,
> hw_params has to initialize _or_ to change the parameters.
> 

Okay, so to be sure I setup and release my cyclic DMA buffer safely I
could use the following model:

in prepare callback setup the DMA buffer, once when called. The
hardware parameters should not change at this point.

If I get a hw_params callback after a prepare, then release the DMA
buffer, and set it up again in the prepare callback?

Final cleanup of the DMA buffer can/should be done in hw_free?

This sounds safe given my understanding of ALSA. Is there a flow chart
which shows how the different callbacks can be called?

> > Clemens Ladisch <clemens@xxxxxxxxxx> wrote:
> > > The DMA address is selected by the driver in the hw_params
> > > callback, but most drivers let the framework handle this by
> > > calling snd_pcm_lib_malloc_pages().
> > 
> > Yes, this is what I do today. I am considering if I should release
> > the DMA stuff in hw_free and then in the prepare callback check if
> > it needs to be prepared again (since it was released in hw_free).
> 
> The framework guarantees that prepare is called only when the hardware
> parameters are set.
> 

Noted.

-- 
Best regards,
Hans-Christian Egtvedt
_______________________________________________
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