Hi there
I’m setting up a DMA transfer and I use AllocateAdapterChannel in my
StartIo() routine. Although I included <wdm.h> the compiler says that this
function is unknown. The same happens with “PutDmaAdapter”,
“FlushAdapterBuffers” and “FreeAdapterChannel”. But
“IoAllocateAdapterChannel” is accepted!I’m using Win XP and it’s DDK.
What’s wrong? Are these commands obsolete?
Thanks for halp and merry X-mas!</wdm.h>
from the DDK:
PutDmaAdapter is not a system routine that can be called directly by
name. This routine is callable only by pointer from the address returned
in a DMA_OPERATIONS structure. Drivers obtain the address of this
routine by calling IoGetDmaAdapter.
The DMA functions are not exported functions. They’re methods
associated with the DMA Adapter you created. You need to dig the
function pointer out of the DMA_ADAPTER structure
(DmaAdapter->DmaOperations->PutDmaAdapter(…)) and call that.
-p
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Daniel Luethi
Sent: Wednesday, December 17, 2003 8:52 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] DMA transfer
Hi there
I’m setting up a DMA transfer and I use AllocateAdapterChannel in my
StartIo() routine. Although I included <wdm.h> the compiler says that
this function is unknown. The same happens with “PutDmaAdapter”,
“FlushAdapterBuffers” and “FreeAdapterChannel”. But
“IoAllocateAdapterChannel” is accepted!I’m using Win XP and it’s DDK.
What’s wrong? Are these commands obsolete?
Thanks for halp and merry X-mas!
—
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
You are currently subscribed to ntdev as: xxxxx@microsoft.com To
unsubscribe send a blank email to xxxxx@lists.osr.com</wdm.h>
Thanks Peter, I changed that and the compiler was satisfied, so far so
good! But when I run through the code in StartIo, I get a page fault and
the system crashes down. My code is:
…
pFdoInfo->pDmaWriteObj->pDmaAd->DmaOperations->AllocateAdapterChannel
(
pFdoInfo->pDmaWriteObj->pDmaAd, // pointer to DMA adapter
pFdo, // my own, in AddDevice created
functional device object
pFdoInfo->pDmaWriteObj->nMapReg, // number of map registers to be
used in the transfer (=5)
AdapterControl, // Adapter Control routine,
written by myself
pFdoInfo->pDmaWriteObj // my own struct for device
extension (passing context)
);
The param pDmaAd I got from IoGetDmaAdapter, nMapReg is confirmed from the
same function (->I checked it in Debugger), and the pDmaWriteObj is simply
a struct I made to store the necessary data. Actually I followed pretty
much the instructions from the Windows 2000 device driver book and the NT
Device Driver Development from P.G. Viscarola. I haven’t got a clue what’s
wrong. We made the PCI card in our house and it’s bus master capable.
Could it be a problem, that I made two adapter objects for one device, one
for write and one for read?
Thanks for help
Daniel
Daniel,
-
Do you have a debugger (WinDBG or SoftICE) connected, and if so, what is
the exact location of the page fault, and what is the address being
accessed. (If you don’t have a debugger, download WinDBG from MS, or install
the one included in your DDK).
-
Look at the stack-trace to figure out what way you ended up where you are
in the driver. It’s usually obvious what’s gone wrong.
-
Run Driver Verifier. It helps with identifying “programmer temporary
stupidity” (which I’m sure every driver writer will confess to having had at
some point or another). An experinced driver writer will have more
“Autopilot” detection for these, but the interfaces are complex enough, and
there are many ways we can “forget” or “miss” something. Driver Verifier
catches those things, in many cases.
–
Mats
-----Original Message-----
From: Daniel Luethi [mailto:xxxxx@psi.ch]
Sent: Thursday, December 18, 2003 3:42 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] RE: DMA transfer
Thanks Peter, I changed that and the compiler was satisfied, so far so
good! But when I run through the code in StartIo, I get a
page fault and
the system crashes down. My code is:
…
pFdoInfo->pDmaWriteObj->pDmaAd->DmaOperations->AllocateAdapterChannel
(
pFdoInfo->pDmaWriteObj->pDmaAd, // pointer to DMA adapter
pFdo, // my own, in AddDevice created
functional device object
pFdoInfo->pDmaWriteObj->nMapReg, // number of map
registers to be
used in the transfer (=5)
AdapterControl, // Adapter Control routine,
written by myself
pFdoInfo->pDmaWriteObj // my own struct for device
extension (passing context)
);
The param pDmaAd I got from IoGetDmaAdapter, nMapReg is
confirmed from the
same function (->I checked it in Debugger), and the
pDmaWriteObj is simply
a struct I made to store the necessary data. Actually I
followed pretty
much the instructions from the Windows 2000 device driver
book and the NT
Device Driver Development from P.G. Viscarola. I haven’t got
a clue what’s
wrong. We made the PCI card in our house and it’s bus master capable.
Could it be a problem, that I made two adapter objects for
one device, one
for write and one for read?
Thanks for help
Daniel
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
You are currently subscribed to ntdev as: xxxxx@3dlabs.com
To unsubscribe send a blank email to xxxxx@lists.osr.com
Meanwhile I could solve the problem. With the debugger I discovered,
that the system not crushes straight after the call of
AllocateAdapterChannel()
but 10 or 20 assembler commands later. That made me suspicious and
finally in the “win2k device driver book” I found that while executing
AllocateAdapterChannel() he actually can already call the
AdapterControl() routine which my driver has to provide too. I set a
breakpoint at the beginning of this routine and voilà, it stopped
execution there and after a few stepping trough this routine I figured
out pretty easily that one parameter was missing in the call of the
MapTransfer() command, it was an MDl which was set to NULL. I corrected
it and now my DMA workes perfectly!
Next step will be trying out simultanous DMA read and write!
Thanks all for help
Daniel