Re: [Q]: Message

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Sajid (sajidbmsATyahooDOTcom)
Date: 09/03/04


Date: Fri, 3 Sep 2004 11:49:01 +0530

hi Andrew,

Atfirst, I really thank you for the valuable information you rendered
in this respect, as this type of information is tough to get.

Here, i would like to make my audio driver design a bit clear:
I have adopted two DMA buffers of 2K each [this design works well on other
OS].
I have set the software mixer registry for 4 buffers with 4K each.
[HKEY_LOCAL_MACHINE\Audio\SoftwareMixer]
    "SampleRate"=dword:AC44
    "Buffers"=dword:4
    "BufferSize"=dword:1000
    "EnableLowPassFilter"=dword:1
    "Priority 256"=dword:dc

I would include the code for the normal causes as mentioned by you.

Moreover, I have the working audio driver code with the software mixer
disabled.
So, I do not see much problem in DMA case, rather i see something fishy in
software
buffer handling code, as I have re-designed the software buffer management
code in my audio driver from earlier single buffer to a linked list of
WAVEHDR
structure instances.

I am glad to say that your information has given me a better understanding
of the
middle layer now. Thank you.

regards
sajid

"Andrew Raffman" <andyraf@microsoft.com> wrote in message
news:zEyL$ESkEHA.3628@cpmsftngxa10.phx.gbl...
> The software mixer allocates a set of internal buffers, mixes into them as
> needed, and sends them down to the audio driver for playback. The mixer
> uses a semaphore to keep track of the number of free buffers. As buffers
> are sent down to the audio driver, the semaphore is decremented, and as
the
> audio driver returns the buffers the semaphore is incremented. Each time
> the mixer needs to send more data to the driver, it waits on the semaphore
> for up to 1 second for a buffer to become available (in other words, for
> the semaphore count to be non-zero).
>
> The message you received ("SwMixer: WaitForBuffer failed. Audio driver
> missed interrupt?") means that the wait on the semaphore for an available
> buffer timed out, indicating that all the buffers are lodged in the audio
> device driver and have not been returned in a timely manner to the mixer.
>
> This typically means that one of the following problems has occurred. (I'm
> assuming your underlying hardware has a DMA channel to move audio data to
a
> CODEC, and generates an interrupt when each DMA operation is compete,
which
> then wakes up an IST thread to move more data to the DMA buffer):
>
> - The audio DMA operation did not complete and did not generate an
> interrupt.
> - The DMA interrupt was improperly masked
> - The interrupt occurred, but some unexpected DMA condition caused the IST
> to ignore the interrupt (e.g. some DMA error bits were set), causing
> everything to stop. For example, on the SA1100 we've seen cases where the
> DCSR_ERROR bit is set for no apparent reason, and the only workaround is
> to recognize this condition and restart the DMA operation.
> - The IST became hung due to a deadlock, infinite loop, or starvation due
> to some other high priority thread.
> - After copying the (SW mixer) buffer to the DMA buffer, the IST never
> returned the buffer to the wave subsystem.
>
> You should be able to instrument your wave driver to determine which of
> these conditions has taken place.
>
> An outside possibility is that the mixer driver has used either too few
> buffers, or each buffer is too small; and the audio driver is using
> extremely large DMA buffers. Under these conditions, it might take too
long
> for the audio driver to return a buffer to the SW mixer. This seems
> unlikely, as it would require each audio DMA buffer to hold more than 1
> second worth of data. However, this type of situation is often the cause
of
> unexplained dropouts in audio output (e.g. "I heard some dropouts, so I
> increased my DMA buffer size and the dropouts got worse rather than
> better"). In general, it's important to size the driver's DMA buffers and
> the SW mixer's buffers so that at any time the SW mixer has at least one
> buffer available to mix into.
>
> The audio driver can control the number and size of the buffers which the
> sw mixer allocates by correctly handling the WODM_GETEXTDEVCAPS message
and
> filling in the associated WAVEOUTEXTCAPS structure. This structure is also
> used to tell the SW mixer how many streams the driver can mix (for drivers
> that support doing their own mixing), and also to tell the SW mixer the
> preferred sample rate of the audio driver.
>
>



Relevant Pages

  • Re: Handling high UDP throughput
    ... The product that uses this sustains 540MbS with a 38kHz interrupt running using more than half the processor's power, so a lot goes on in the system but a lot of time is available for TCP/IP. ... The Ethernet driver was optimized, the memory movement was optimized (just using an inline memcpy that does a DMA transfer adds 30% to the effective speed), the IP checksum was in assembly, and a zero-copy TCP/IP stack was required. ... How much TX buffers did you have? ...
    (comp.arch.embedded)
  • non barrier versions of dma_map functions
    ... This is a request for extending the DMA api for efficient handling of multiple buffers or scatter gather mapping/unmapping operations. ... On ARMv7 it performs the necessary cache-operations and calls data sync barrier instruction (DSB). ...
    (Linux-Kernel)
  • RFC non barrier versions of dma_map functions
    ... This is a request for extending the DMA api for efficient handling of multiple buffers or scatter gather mapping/unmapping operations. ... On ARMv7 it performs the necessary cache-operations and calls data sync barrier instruction (DSB). ...
    (Linux-Kernel)
  • Re: USB mass storage and ARM cache coherency
    ... transfers and DMA for bulk transfers. ... The current stack performs dma cache maintenance even for the PIO transfers ... which leads to the corruption issue. ... The control buffers are handled by CPU ...
    (Linux-Kernel)
  • Re: 1394 and Vista64
    ... I had my fair amount of aggravation running dma above 4Gb. ... I had some success forcing all buffers that took place in a dma to ... I dislike the idea of bounce buffers, but the alternative in my case ... Say it's a dma to the chip: ...
    (microsoft.public.development.device.drivers)