All of lore.kernel.org
 help / color / mirror / Atom feed
* snd_pcm_hardware structure
@ 2010-06-23 17:22 Adish Kuvelker
  2010-06-23 17:45 ` James Courtier-Dutton
  0 siblings, 1 reply; 8+ messages in thread
From: Adish Kuvelker @ 2010-06-23 17:22 UTC (permalink / raw)
  To: alsa-devel

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"?

Regards;
Aadish

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: snd_pcm_hardware structure
  2010-06-23 17:22 snd_pcm_hardware structure Adish Kuvelker
@ 2010-06-23 17:45 ` James Courtier-Dutton
  2010-06-23 17:57   ` Adish Kuvelker
  0 siblings, 1 reply; 8+ messages in thread
From: James Courtier-Dutton @ 2010-06-23 17:45 UTC (permalink / raw)
  To: Adish Kuvelker; +Cc: alsa-devel

On 23 June 2010 18:22, Adish Kuvelker <adkuvi@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.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: snd_pcm_hardware structure
  2010-06-23 17:45 ` James Courtier-Dutton
@ 2010-06-23 17:57   ` Adish Kuvelker
  2010-06-23 18:47     ` James Courtier-Dutton
  0 siblings, 1 reply; 8+ messages in thread
From: Adish Kuvelker @ 2010-06-23 17:57 UTC (permalink / raw)
  To: James Courtier-Dutton; +Cc: alsa-devel

Hello James,
Thanks a lot....Just a typo error for the period_bytes_min and
period_bytes_max in my mail.....

Now that my FIFO is 64 bytes and if I need an interrupt to the CPU for
FIFO being half-empty (i.e 32 bytes = 16 16-bit samples), would it be
right to set the periods_min = periods_max = 32?

Regards,
Aadish

On Wed, Jun 23, 2010 at 11:15 PM, James Courtier-Dutton
<james.dutton@gmail.com> wrote:
> On 23 June 2010 18:22, Adish Kuvelker <adkuvi@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.
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: snd_pcm_hardware structure
  2010-06-23 17:57   ` Adish Kuvelker
@ 2010-06-23 18:47     ` James Courtier-Dutton
  2010-06-23 20:26       ` Adish Kuvelker
  0 siblings, 1 reply; 8+ messages in thread
From: James Courtier-Dutton @ 2010-06-23 18:47 UTC (permalink / raw)
  To: Adish Kuvelker; +Cc: alsa-devel

On 23 June 2010 18:57, Adish Kuvelker <adkuvi@gmail.com> wrote:
> Hello James,
> Thanks a lot....Just a typo error for the period_bytes_min and
> period_bytes_max in my mail.....
>
> Now that my FIFO is 64 bytes and if I need an interrupt to the CPU for
> FIFO being half-empty (i.e 32 bytes = 16 16-bit samples), would it be
> right to set the periods_min = periods_max = 32?
>

No. The periods do not create the interrupt.
Your sound hardware has to do the interrupt.
When does you hardware do the interrupt?

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: snd_pcm_hardware structure
  2010-06-23 18:47     ` James Courtier-Dutton
@ 2010-06-23 20:26       ` Adish Kuvelker
  2010-06-23 20:41         ` Adish Kuvelker
  2010-06-23 21:13         ` James Courtier-Dutton
  0 siblings, 2 replies; 8+ messages in thread
From: Adish Kuvelker @ 2010-06-23 20:26 UTC (permalink / raw)
  To: James Courtier-Dutton; +Cc: alsa-devel

yes...I know that my hardware will generate the interrupt and it will
be at FIFO being half empty.

On Thu, Jun 24, 2010 at 12:17 AM, James Courtier-Dutton
<james.dutton@gmail.com> wrote:
> On 23 June 2010 18:57, Adish Kuvelker <adkuvi@gmail.com> wrote:
>> Hello James,
>> Thanks a lot....Just a typo error for the period_bytes_min and
>> period_bytes_max in my mail.....
>>
>> Now that my FIFO is 64 bytes and if I need an interrupt to the CPU for
>> FIFO being half-empty (i.e 32 bytes = 16 16-bit samples), would it be
>> right to set the periods_min = periods_max = 32?
>>
>
> No. The periods do not create the interrupt.
> Your sound hardware has to do the interrupt.
> When does you hardware do the interrupt?
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: snd_pcm_hardware structure
  2010-06-23 20:26       ` Adish Kuvelker
@ 2010-06-23 20:41         ` Adish Kuvelker
  2010-06-23 21:13         ` James Courtier-Dutton
  1 sibling, 0 replies; 8+ messages in thread
From: Adish Kuvelker @ 2010-06-23 20:41 UTC (permalink / raw)
  To: James Courtier-Dutton; +Cc: alsa-devel

so I am thinking of sound hardware generating an interrupt at the FIFO
having 32-bytes.
In your first reply did you mean that periods_min = periods_max =1
would be the setting correponding to my hardware initializations to
generate an interrupt after 16 16-bit samples having been transferred?
So considering that the FIFO bank is of 64 bytes, what do you think
would be the setting for periods_min and periods_max?

Regards;
Aadish

On Thu, Jun 24, 2010 at 1:56 AM, Adish Kuvelker <adkuvi@gmail.com> wrote:
> yes...I know that my hardware will generate the interrupt and it will
> be at FIFO being half empty.
>
> On Thu, Jun 24, 2010 at 12:17 AM, James Courtier-Dutton
> <james.dutton@gmail.com> wrote:
>> On 23 June 2010 18:57, Adish Kuvelker <adkuvi@gmail.com> wrote:
>>> Hello James,
>>> Thanks a lot....Just a typo error for the period_bytes_min and
>>> period_bytes_max in my mail.....
>>>
>>> Now that my FIFO is 64 bytes and if I need an interrupt to the CPU for
>>> FIFO being half-empty (i.e 32 bytes = 16 16-bit samples), would it be
>>> right to set the periods_min = periods_max = 32?
>>>
>>
>> No. The periods do not create the interrupt.
>> Your sound hardware has to do the interrupt.
>> When does you hardware do the interrupt?
>>
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: snd_pcm_hardware structure
  2010-06-23 20:26       ` Adish Kuvelker
  2010-06-23 20:41         ` Adish Kuvelker
@ 2010-06-23 21:13         ` James Courtier-Dutton
  2010-06-23 21:59           ` Adish Kuvelker
  1 sibling, 1 reply; 8+ messages in thread
From: James Courtier-Dutton @ 2010-06-23 21:13 UTC (permalink / raw)
  To: Adish Kuvelker; +Cc: alsa-devel

On 23 June 2010 21:26, Adish Kuvelker <adkuvi@gmail.com> wrote:
> yes...I know that my hardware will generate the interrupt and it will
> be at FIFO being half empty.
>

In that case the full buffer is 64, but you have the following parameters:
.period_bytes_min = 4,
.period_bytes_max = 32,
.periods_min = 2,
.periods_max = 2

A period is how far through the buffer one goes until an interrupt happens.
So, if the interrupt happens one each half FIFO, one has two periods per buffer.

Kind Regards

James

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: snd_pcm_hardware structure
  2010-06-23 21:13         ` James Courtier-Dutton
@ 2010-06-23 21:59           ` Adish Kuvelker
  0 siblings, 0 replies; 8+ messages in thread
From: Adish Kuvelker @ 2010-06-23 21:59 UTC (permalink / raw)
  To: James Courtier-Dutton; +Cc: alsa-devel

Thanks a lot James

Regards;
Aadish

On Thu, Jun 24, 2010 at 2:43 AM, James Courtier-Dutton
<james.dutton@gmail.com> wrote:
> On 23 June 2010 21:26, Adish Kuvelker <adkuvi@gmail.com> wrote:
>> yes...I know that my hardware will generate the interrupt and it will
>> be at FIFO being half empty.
>>
>
> In that case the full buffer is 64, but you have the following parameters:
> .period_bytes_min = 4,
> .period_bytes_max = 32,
> .periods_min = 2,
> .periods_max = 2
>
> A period is how far through the buffer one goes until an interrupt happens.
> So, if the interrupt happens one each half FIFO, one has two periods per buffer.
>
> Kind Regards
>
> James
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2010-06-23 21:59 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-23 17:22 snd_pcm_hardware structure Adish Kuvelker
2010-06-23 17:45 ` James Courtier-Dutton
2010-06-23 17:57   ` Adish Kuvelker
2010-06-23 18:47     ` James Courtier-Dutton
2010-06-23 20:26       ` Adish Kuvelker
2010-06-23 20:41         ` Adish Kuvelker
2010-06-23 21:13         ` James Courtier-Dutton
2010-06-23 21:59           ` Adish Kuvelker

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.