Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results

Home NTDEV
Before Posting...
Please check out the Community Guidelines in the Announcements and Administration Category.

More Info on Driver Writing and Debugging


The free OSR Learning Library has more than 50 articles on a wide variety of topics about writing and debugging device drivers and Minifilters. From introductory level to advanced. All the articles have been recently reviewed and updated, and are written using the clear and definitive style you've come to expect from OSR over the years.


Check out The OSR Learning Library at: https://www.osr.com/osr-learning-library/


Doubt in sample code for waveRT audio driver in ac97 audio device in win-ddk

OSR_Community_UserOSR_Community_User Member Posts: 110,217
Hi,
I am a novice in writing drivers. I am trying to develop waveRT audio driver for windows 7.

I am looking at the code sample for ac97 audio device (provided with win ddk) which includes sample for writing waveRT drivers.

I am quite confused with the mdl (memory descriptor list) and bdl(buffer descriptor list) code in stream.h and stream.cpp files.

I understand that the IMiniportWaveRT stream interface requires us to implement AllocateAudioBuffer method. This method allocates a memory descriptor list using the AllocateContiguousPagesForMdl(since the device in the sample code does not support scatter-gather) method of PORTWAVERTSTREAM interface, an instance of which is passed to the driver while creating a new stream. After this memory allocation succeeds, BDL(buffer descriptor list) is programmed, and this is where I get confused. Following is the code snippet which does that:

PMDL audioBufferMdl = m_pPortStream->AllocateContiguousPagesForMdl (low, high, requestedSize);
//
// Program the BDL
//
for (UINT loop = 0; loop < MAX_BDL_ENTRIES; loop++)
{
BDList[loop].dwPtrToPhyAddress = m_pPortStream->GetPhysicalPageAddress (audioBufferMdl, 0).LowPart;
BDList[loop].wLength = (WORD)requestedSize/2;
if ((loop == MAX_BDL_ENTRIES / 2) || (loop == MAX_BDL_ENTRIES - 1))
BDList[loop].wPolicyBits = IOC_ENABLE;
else
BDList[loop].wPolicyBits = 0;
}

I don't understand why while getting the physical address of the Mdl, we always use the index as 0? Why all the entries of BDList point to same physical address?

Also, it would be great if anyone can give me any pointers to understand the concepts behind MDL and BDL wrt waveRT audio drivers.

Thanks in advance!
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Upcoming OSR Seminars
OSR has suspended in-person seminars due to the Covid-19 outbreak. But, don't miss your training! Attend via the internet instead!
Writing WDF Drivers 7 Dec 2020 LIVE ONLINE
Internals & Software Drivers 25 Jan 2021 LIVE ONLINE
Developing Minifilters Early 2021 LIVE ONLINE