IoGetDmaAdapter crash

Hi,

The following code crashes right at the IoGetDmaAdapter call. This should be
a legacy driver, so I don’t have PNP and AddDevice with the translated
resources (only DeviceEntry). Crash dump says that PNP manager is crying and
stopped the system.

I don’t want PNP because this is all for an AC97 modem with inbuilt scatter
gather DMA and I don’t have a bus driver. (Bus driver doesn’t exists for
this, as far as I know.) So I think I only need this all in order to use the
Win2k capabilities and to ease my work to build up my scatter gather lists.
However MapTransfer wants me to obtain a DMA_ADAPTER that can be done by
calling IoGetDmaAdapter.

Could someone help me please why it crashes?

fragment of my source code where I got jammed:


DEVICE_DESCRIPTION dd;

// Zero out the entire structure, the fill in the necessary values
RtlZeroMemory( &dd, sizeof(dd) );
dd.Version = DEVICE_DESCRIPTION_VERSION1;
dd.Master = TRUE; // this is a master device
dd.ScatterGather = TRUE;
dd.Dma32BitAddresses = TRUE;
dd.InterfaceType = PCIBus;
dd.DmaSpeed = Compatible;
dd.MaximumLength = MAX_DMA_LENGTH;

// Compute the maximum number of mapping regs
pDevExt->mapRegisterCount =
(MAX_DMA_LENGTH / PAGE_SIZE) + 1;

// obtain DMA adapter object
pDevExt->pDmaAdapter =
IoGetDmaAdapter( pDevObj,
&dd,
&pDevExt->mapRegisterCount);

“kig” wrote in message news:xxxxx@ntdev…
>
> The following code crashes right at the IoGetDmaAdapter call. This should
be
> a legacy driver, so I don’t have PNP and AddDevice with the translated
> resources (only DeviceEntry). Crash dump says that PNP manager is crying
and
> stopped the system.
>

Try passing NULL as a pointer to the first parameter (PDEVICE_OBJECT).

If that doesn’t work, post the resulting crash dump output of analyze -v (I
have yet to see a blue screen that says “PNP mangaer is crying and stopped
the system”). But I suspect that won’t be necessary.

Peter
OSR

Hi,

I can’t thank you enough!!!
It’s Magic! It works! Could you please shortly explain me why?
(Of course “PNP crying” was not the exact error message :slight_smile: )

Thank you very much!

“Peter Viscarola” az alábbiakat írta a következo üzenetben
news:xxxxx@ntdev…
>
>
> “kig” wrote in message news:xxxxx@ntdev…
> >
> > The following code crashes right at the IoGetDmaAdapter call. This
should
> be
> > a legacy driver, so I don’t have PNP and AddDevice with the translated
> > resources (only DeviceEntry). Crash dump says that PNP manager is crying
> and
> > stopped the system.
> >
>
> Try passing NULL as a pointer to the first parameter (PDEVICE_OBJECT).
>
> If that doesn’t work, post the resulting crash dump output of analyze -v
(I
> have yet to see a blue screen that says “PNP mangaer is crying and stopped
> the system”). But I suspect that won’t be necessary.
>
> Peter
> OSR
>
>
>
>
>
>

“kig” wrote in message news:xxxxx@ntdev…
>
> It’s Magic! It works! Could you please shortly explain me why?
>

The first parameter to IoGetDmaAdapter is a pointer to a PDO. But you’re
not writing a PnP driver, you’re writing a legacy driver, similar to that in
NT V4. Thus, you can’t pass the PDO pointer. Instead you pass NULL.

I’m really glad that helped,

Peter
OSR