[wdmaudiodev] Re: Problem about GetMapping() / ReleaseMapping() in WavePCI

  • From: Ken Cooper <Ken.Cooper@xxxxxxxxxxxxx>
  • To: "wdmaudiodev@xxxxxxxxxxxxx" <wdmaudiodev@xxxxxxxxxxxxx>
  • Date: Fri, 17 Oct 2008 12:00:37 -0700

Since you are writing a virtual audio driver, and as Jeff Pages implied in 
another response, you should probably be using WaveCyc instead of WavePCI.  It 
should simplify your driver significantly.

Ken

From: wdmaudiodev-bounce@xxxxxxxxxxxxx 
[mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx] On Behalf Of swapnil kamble
Sent: Friday, October 17, 2008 7:59 AM
To: wdmaudiodev@xxxxxxxxxxxxx
Subject: [wdmaudiodev] Re: Problem about GetMapping() / ReleaseMapping() in 
WavePCI

Hi,
    Thanks for your replies. One more silly question. I am using fake DMA. So 
Do we have to do explicit data copying from capture and render ? which is not 
the property of WavePCI. What processing do we have to do actually in case of 
fake DMA ?

Thanks.
On Fri, Oct 17, 2008 at 4:04 AM, Ken Cooper 
<Ken.Cooper@xxxxxxxxxxxxx<mailto:Ken.Cooper@xxxxxxxxxxxxx>> wrote:



Though you may have already based on your comments, you should look at the AC97 
sample in the WDK that uses WavePci.



In general, you will get two different calls from portcls indicating that you 
should process your mappings.  The first is the Service() call.  This call is 
invoked by portcls in direct response to your Notify() call on the stream's 
ServiceGroup.  The Notify() call can be made from your ISR (or timer DPC) and 
results in queuing of a DPC.  That DPC simply calls Service() on your stream.  
Within your Service() method you should first release any used mappings you 
have by walking your list and calling ReleaseMapping() for any mappings that 
have been completed.  You should then acquire available new mappings (there may 
not be any) with the GetMapping() call to portcls, sticking the new mappings in 
your table.



The other call that you may receive from portcls is MappingAvailable().  This 
method is called by portcls when a new streaming IRP arrives AND you have 
previously called GetMapping() and didn't receive a mapping (in other words, 
you had previously obtained all available mappings or starved).  The processing 
here is the same as in your Service() method.  First release used mappings by 
calling ReleaseMapping() on them.  Then acquire new mappings with GetMapping(), 
typically until you either fill your table or obtain all available mappings 
(which will result in you getting MappingAvailable() when the next IRP arrives).



As for position reporting asked by another poster, you need to provide sample 
accurate position information when you are queried for position by portcls.  
The comment in the WDK AC97 sample for the GetPosition() method says:



/*****************************************************************************

 * CMiniportWaveICHStream::GetPosition

 *****************************************************************************

 * Gets the stream position. This is a byte count of the current position of

 * a stream running on a particular DMA engine.  We must return a sample

 * accurate count or the WaveDrv32 wave drift tests (35.2 & 36.2) will fail.

 *

 * The position is the sum of three parts:

 *     1) The total number of bytes in released buffers

 *     2) The position in the current buffer.

 *     3) The total number of bytes in played but not yet released buffers

 */



If you are running 'fake' DMA and using a timer, you will likely need to keep a 
timestamp and extrapolate your position such that the position appears to be a 
linear, monotonically increasing position.  Note that you reset your position 
when your stream transitions to KSSTATE_STOP.



I hope this explanation helps.



Best Regards,



Ken



From: wdmaudiodev-bounce@xxxxxxxxxxxxx<mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx> 
[mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx<mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx>]
 On Behalf Of Abhay dey
Sent: Thursday, October 16, 2008 12:12 AM
To: wdmaudiodev@xxxxxxxxxxxxx<mailto:wdmaudiodev@xxxxxxxxxxxxx>

Subject: [wdmaudiodev] Re: Problem about GetMapping() / ReleaseMapping() in 
WavePCI



I also posted such mail few days back but there was no reply.
There is not a single person on this mailing list who has worked on WavePCI ????
Your suggestions would really really help us.
Waiting for your reply.

On Tue, Oct 14, 2008 at 4:30 PM, pritesh gajjar 
<gajjar.pritesh@xxxxxxxxx<mailto:gajjar.pritesh@xxxxxxxxx>> wrote:

Hello All,
              I have implemented WavePCI in my driver. My mapping calls of 
GetMapping () and ReleaseMapping () are working fine. Following are thing which 
I have done.

1. I created DmaChannel through  NewMasterDmaChannel(), this works fine gives 
DmaChannel object. Passed as out parameter to NewStream ().
2. Allocated tables through AllocateCommonBuffer() call.
3. Created a timer object , DPC object which calls DPC after every 
interval(e.g. 10ms) and wrote a DPC in which I am calling Notify() of PortCls.
4. Methods of  WavePCI interface are implemented one of them is Service () 
which is invoked after above Notfiy() call by PortCls.
5. This Service() gives call to ReleaseMapping()/GetMapping() methods saves 
their out parameters in a table as ac'97 does.

   This is implemented as per MSDN documentation. Now the Driver runs 
continuously and consumes so many CPU cycles, the system slows down. But if I 
only obtain possible mappings in first GetMapping () call that is no 
MappingAvailable () then it runs smoothly. But still I do not get any audio 
only noise is produced. And one more thing I do get some value in VirtAddr 
pointer of GetMapping () .
    I also tried with common table between Capture / Renderer streams, but that 
didn't help. With IDmaChannel channel implementation also I tried, and passed 
casted stream object through Newstream(), but that also didn't helped.

   Is there something else also that in WavePCI it needs to be implemented. If 
anyone has any suggestion about then please reply ?


--
Thanks and regards
Pritesh





--
...Swapnil

|| Hare Krishna Hare Krishna Krishna Krishna Hare Hare ||
|| Hare Rama    Hare Rama   Rama   Rama    Hare Hare ||

Other related posts: