[wdmaudiodev] Re: Problem on setting wavecyclc

  • From: "Sam Tertzakian" <sam@xxxxxxxxxxx>
  • To: <wdmaudiodev@xxxxxxxxxxxxx>
  • Date: Fri, 19 Aug 2005 13:02:30 -0700

Here is a list of things I would do:

 

1.      I would use a sine wave sound for testing (for both render/capture).
The predictable audio will help to diagnose drop outs and other problems.
2.      In the DEBUG build, I would clear all the buffers with
RtlZeroMemory() as soon as they come from GetMapping(). This will help to
make sure you are actually filling the entire buffer.
3.      In the DEBUG driver I would log all buffers as they are filled with
data. I would look at this output using DbgView from www.sysinternals.com
<http://www.sysinternals.com/> . You want to log when the buffers arrive,
when they are filled with data, and when they are released.
4.      Before doing any tests, I would validate the test setup by using the
onboard audio. For example, for render test, play the file with onboard
audio to make sure it is a good file and does not make the "sha-sha" sound.
For capture test, I would capture using the onboard audio to make sure all
the cables are connected properly.
5.      When logging (step 3), you should dump the data you are writing to
files as 16-bit integers. Then, you should compare that data with the data
in the raw wave file (if you are rendering).
6.      Of course, you have to make sure you are properly programming your
device for the proper sample rate, sample size, etc.
7.      if you have an independent way of testing the hardware, try to use
information from those test and compare how you are programming the
registers in the test program with what you are doing in your driver.
8.      Make sure to read completely the DDK docs to make sure you have not
missed something that did not seem obvious when you used the sample driver.

 

Depending on your problem, I am sure one of the above steps will give you
more information. I am sure this is not an exhaustive list. But, it is
definitely a place to start.

 

For example, suppose that after RtlZeroMemory() the "sha-sha" goes away:
Then, it means you were probably never filling the buffers with data.

 

When logging, make sure to write that code in a way that it will be
permanently a part of the source code in the driver that can be turn on/off
when you need it. I am sure you will need to do this type of logging again,
and you don't want to rewrite that every time.

 

I hope you are able to find the solution.let me know what happens.

 

  _____  

From: wdmaudiodev-bounce@xxxxxxxxxxxxx
[mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx] On Behalf Of PB
Sent: Friday, August 19, 2005 5:30 AM
To: wdmaudiodev@xxxxxxxxxxxxx
Subject: [wdmaudiodev] Re: Problem on setting wavecyclc

 

Hi,

 

I have sucessfully changed to driver to use WavePCI from WaveCyclc and all
interrupts of PCI and feedbacks are corrected. But there is a problem I am
still working and can't find the solution. The sound output is only "sha
sha" noise instead of normally audio. From your experience, where should be
the problem located? And any possible solution to check and fix? 

 

Really thank you very much.

 

Regards,

Peter

----- Original Message ----- 

From: Sam Tertzakian <mailto:sam@xxxxxxxxxxx>  

To: wdmaudiodev@xxxxxxxxxxxxx 

Sent: Saturday, July 02, 2005 2:37 AM

Subject: [wdmaudiodev] Re: Problem on setting wavecyclc

 

Well, I suggest you start with the AC97 sample. And look for ways to make
your code work within the existing frame work. It is a very good sample.

 

The difficult thing about WavePCI is you have to be very careful how you
synchronize the driver when you use GetMapping() (the function that gets
audio buffers). But, the sample shows how to do this.

 

If you have any more questions, let me know.and I'll try to answer them. If
things go well, you may be able to have a driver up and running in a few
days or even less.

 


  _____  


From: wdmaudiodev-bounce@xxxxxxxxxxxxx
[mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx] On Behalf Of PB
Sent: Friday, July 01, 2005 9:23 AM
To: wdmaudiodev@xxxxxxxxxxxxx
Subject: [wdmaudiodev] Re: Problem on setting wavecyclc

 

Really thank for your kindy suggestion. We now try to use WavePCI instead.
Thank you very much.

 

If it's possiblem, any WavePCI reference we can have to have faster
constructing the code with WHQL? Is there any specific part of WavePCI we
need to focus when writing the driver? Thanks

----- Original Message ----- 

From: Sam Tertzakian <mailto:sam@xxxxxxxxxxx>  

To: wdmaudiodev@xxxxxxxxxxxxx 

Sent: Friday, July 01, 2005 1:47 PM

Subject: [wdmaudiodev] Re: Problem on setting wavecyclc

 

Sorry, for the delay in the response.

 

What I meant was.I mananged to get audio to play/record.but, for various
reasons some of the WHQL tests would not pass.

 

It is for this reason, I switched to WavePCI. After that, the WHQL tests
passed.

 

I would be happy to provide you source code, but I just don't have it now.

 

Again, I suggest you use WavePCI instead.it is a lot easier to understand
and you have more control over the data movement in the driver.

 


  _____  


From: wdmaudiodev-bounce@xxxxxxxxxxxxx
[mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx] On Behalf Of PB
Sent: Thursday, June 23, 2005 7:33 AM
To: wdmaudiodev@xxxxxxxxxxxxx
Subject: [wdmaudiodev] Re: Problem on setting wavecyclc

 

Thanks for your reply.

 

In fact, I have tried to write the driver by using WavePCI, but the IC
manufacturer suggested us to use WaveCyclic instead of WavePCI. I am very
happy to hear you getting WaveCyclic works. If it's possiblem, can you just
let me know the setting of Master Channel? or just please give us only the
part of DMA channel source code for reference? This is really thanks.

 

Regards,

Peter

----- Original Message ----- 

From: Sam Tertzakian <mailto:sam@xxxxxxxxxxx>  

To: wdmaudiodev@xxxxxxxxxxxxx 

Sent: Thursday, June 23, 2005 3:58 AM

Subject: [wdmaudiodev] Re: Problem on setting wavecyclc

 

I struggled for a long time with WaveCyclic model. I finally got it work,
but I can tell you this.even if you get it to work, you will have other
problems.

 

You should not use WaveCyclic. Use WavePCI instead. (Don't let the "pci"
bother you.you can use it for any kind of driver).

 

You will be a lot happier. 

 


  _____  


From: wdmaudiodev-bounce@xxxxxxxxxxxxx
[mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx] On Behalf Of PB
Sent: Sunday, June 19, 2005 9:19 AM
To: wdmaudiodev@xxxxxxxxxxxxx
Subject: [wdmaudiodev] Problem on setting wavecyclc

 

I am writing an window audio driver by Microsoft 
Window Driver Development Kit(DDK) for window XP. 
I have followed the archecture of the driver sample
code provided under the folder SB16 which are using
WaveCyclic Interface and Slave Channel method to build
the sound card audio driver. 

 

However, since our chip on the sound card have not 
provide us the default channel, we use the Master Channel
method to create DMA channel and using allocate buffer API
similar as Slave method provided in the sample code.
------------------------------------------------------------
e.g.
       ntStatus = 
            Port->NewMasterDmaChannel 
            (  
               &MyDmaChannel,      // OutDmaChannel
               NULL,             // OuterUnknown (opt)
               NULL,             // ResourceList (opt)
               MAXLEN_DMA_BUFFER,    //Maximum Length            
               TRUE,             // Dma32BitAddresses
               FALSE,            // Dma64BitAddresses
               Width32Bits,      // DmaWidth
               Compatible
             );               // DmaPort
        if (NT_SUCCESS(ntStatus))
        {
            ULONG  lDMABufferLength = MAXLEN_DMA_BUFFER;
            
            do {
              ntStatus =
MyDmaChannel->AllocateBuffer(lDMABufferLength,NULL);
              lDMABufferLength >>= 1;
              _DbgPrintF(DEBUGLVL_TERSE, ("lDMABufferLength = 0x%x",
lDMABufferLength));
              
            } while (!NT_SUCCESS(ntStatus) && (lDMABufferLength > (PAGE_SIZE
/ 2)));
        }

 

        if (NT_SUCCESS(ntStatus))
        {
           ..
 
AdapterCommon->WriteMCControlRegister((ULONG)PLAYBACK_DMA_CURRENT_BASE_ADDR,

 
(ULONG)MyDmaChannel->PhysicalAddress().QuadPart);
           
------------------------------------------------------------

 

However no matter how we tried, we cannot get the audio sound out.
We have seen in the debugger that all the register of our chip is now
controllable and the
address of the allocate addressed is sured can written to our audio chip.
We have seen the sequence in the window such as:
--------------------
[ValidateFormat]
[SetNotificationFreq]
[ServiceWaveISR]
[SetState]
--------------------

 

can be runned under the testing on debugger. 
I have seen from the MSDN help menu that for master channel, user need to
use the API "copyto", "copyfrom" to copy data from and to the audio buffer.
It seems that it is not necessary in the slave channel method. Is it really
necessary in the master channel method?
And how can I know the address of where the data come from when Window Media

wave file? I have no method to fill in the parameter of the "copyto",
"copyfrom" API to use them.

Or anyone can post the reference code for masterchannel  of Driver?

 

Thans you very much

 

 

Best Regards,

Peter

Other related posts: