[alsa-devel] snd_pcm_hardware structure

James Courtier-Dutton james.dutton at gmail.com
Wed Jun 23 19:45:04 CEST 2010

On 23 June 2010 18:22, Adish Kuvelker <adkuvi at gmail.com> wrote:
> Hello,
> I am developing a ALSA driver for the AtlasIII AC'97 Controller. The
> AC'97 Controller FIFO is arranged as 16 32-bit entries. My PCM data
> would be 16-bit samples and the driver will cater to 2-front channel
> audio. I have configured the snd_pcm_hardware members as follows:
> .formats = SNDDRV_PCM_FMTBIT_S16_LE
> .period_bytes_max = 4,
> .period_bytes_min = 64,
> As I would need a minimum of 4-byte sample to be transferred and the
> "period_bytes_max" value has been set considering the maximum size of
> the FIFO in bytes. Is my understanding correct in doing these
> settings?
> Secondly, I am having slight problems in understanding the
> "snd_pcm_hardware" members periods_min and periods_max. Can anyone
> throw some more light on this in addition to what is explained in the
> "Writing an Audio Driver"?

max should = 64
min should = 4

periods_min and periods_max is dependent on when the sound card
interrupts the CPU.
So, if the CPU gets an interrupt once every 16 samples, then
periods_min = periods_max = 1
If the sound card does not interrupt the CPU at all, you have to
provide a method to notify the CPU when to next fill the FIFO.

More information about the Alsa-devel mailing list