* buffer/period constraint
@ 2004-07-20 16:15 fmoraes
2004-07-20 16:32 ` Giuliano Pochini
2004-07-21 7:05 ` Clemens Ladisch
0 siblings, 2 replies; 4+ messages in thread
From: fmoraes @ 2004-07-20 16:15 UTC (permalink / raw)
To: alsa-devel
Hi,
Is the a way to force the period/buffer sizes so that they have an integral relationship?
I've seen some cases where the buffer size is 1 or 2 frames bigger than n*period_size, so I am not sure how the driver is supposed to handle that. It ends causing noise the output for now, but I'd like to avoid it.
Second, is there an easy way to find the current position of the DMA being used?
Thanks,
Francisco
-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: buffer/period constraint
2004-07-20 16:15 buffer/period constraint fmoraes
@ 2004-07-20 16:32 ` Giuliano Pochini
2004-07-21 7:05 ` Clemens Ladisch
1 sibling, 0 replies; 4+ messages in thread
From: Giuliano Pochini @ 2004-07-20 16:32 UTC (permalink / raw)
To: fmoraes; +Cc: alsa-devel
On Tue, 20 Jul 2004 fmoraes@nc.rr.com wrote:
> Hi,
>
> Is the a way to force the period/buffer sizes so that they have an
> integral relationship ?
There are many examples:
grep -r snd_pcm_hw_constraint_integer .
[...]
./alsa-kernel/pci/intel8x0.c: if ((err =
snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0)
[...]
> Second, is there an easy way to find the current position of the DMA
> being used ?
It depends on the hardware... Usually you only have to read a value from a
register.
--
Giuliano.
-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: buffer/period constraint
2004-07-20 16:15 buffer/period constraint fmoraes
2004-07-20 16:32 ` Giuliano Pochini
@ 2004-07-21 7:05 ` Clemens Ladisch
2004-07-21 7:52 ` Lee Revell
1 sibling, 1 reply; 4+ messages in thread
From: Clemens Ladisch @ 2004-07-21 7:05 UTC (permalink / raw)
To: fmoraes; +Cc: alsa-devel
fmoraes@nc.rr.com wrote:
> [...]
> I've seen some cases where the buffer size is 1 or 2 frames bigger
> than n*period_size,
The hardware must generate interrupts at period boundaries. In these
cases, the interrupts would happen at different positions in the
buffer, over time.
> so I am not sure how the driver is supposed to handle that.
The driver mustn't allow this unless the hardware can manage it.
> Second, is there an easy way to find the current position of the
> DMA being used?
In the good ol' times of the ISA bus, the DMA controller knew the
current position. On the PCI bus, the DMA is controlled by the card
itself, so the card should have a register for the current position.
If there isn't such a register, you have to count interrupts (and hope
that none are lost).
HTH
Clemens
-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: buffer/period constraint
2004-07-21 7:05 ` Clemens Ladisch
@ 2004-07-21 7:52 ` Lee Revell
0 siblings, 0 replies; 4+ messages in thread
From: Lee Revell @ 2004-07-21 7:52 UTC (permalink / raw)
To: Clemens Ladisch; +Cc: fmoraes, alsa-devel
On Wed, 2004-07-21 at 03:05, Clemens Ladisch wrote:
> fmoraes@nc.rr.com wrote:
> > [...]
> > I've seen some cases where the buffer size is 1 or 2 frames bigger
> > than n*period_size,
>
> The hardware must generate interrupts at period boundaries. In these
> cases, the interrupts would happen at different positions in the
> buffer, over time.
>
> > so I am not sure how the driver is supposed to handle that.
>
> The driver mustn't allow this unless the hardware can manage it.
>
> > Second, is there an easy way to find the current position of the
> > DMA being used?
>
> In the good ol' times of the ISA bus, the DMA controller knew the
> current position. On the PCI bus, the DMA is controlled by the card
> itself, so the card should have a register for the current position.
> If there isn't such a register, you have to count interrupts (and hope
> that none are lost).
>
Look at snd_pcm_update_hw_ptr_interrupt() in
alsa-kernel/core/pcm_lib.c. This gets called by
snd_pcm_period_elapsed(), which gets called by your interrupt handler.
If you are trying to reverse engineer the allowed period sizes, this is
a good place to start - do something that you think should set the
period to N and then check the hw_ptr value in that function against
what you think it should be.
If you have to count interrupts, it is pretty easy to figure out whether
you are missing some. It does happen, a lot. I hacked the emu10k1
driver to do this, the code is pretty ugly but it does the trick.
Lee
-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2004-07-21 7:52 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-20 16:15 buffer/period constraint fmoraes
2004-07-20 16:32 ` Giuliano Pochini
2004-07-21 7:05 ` Clemens Ladisch
2004-07-21 7:52 ` Lee Revell
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.