Yes, I returned DeallocateObjectkeepRegisters in the call back routine, and called IoFreeMapRegisters in DPC routine.
The IoAllocateAdapterChannel failed at the first time it was called.
There is no real headware on the machine, is that a problem? But I get the Adapter Object using HalGetAdapter().
And why the call back routine was called even IoAllocateAdapterChannel is failed.
Thank you very much
Jian
----- Original Message -----
From: Gary Little
To: NT Developers Interest List
Sent: Monday, June 18, 2001 3:10 PM
Subject: [ntdev] RE: IoAllocateAdapterChannel() return STATUS_INSUFFICIENT _RESOURCES?
Are you releasing the resources when done with them? Your adapter call back should return DeallocateObjectkeepRegisters and then you free the registers in your DPC routine.
Gary G. Little
Staff Engineer
Broadband Storage, Inc.
xxxxx@Broadstor.com
xxxxx@inland.net
-----Original Message-----
From: Jian [mailto:xxxxx@yahoo.com]
Sent: Monday, June 18, 2001 3:04 PM
To: NT Developers Interest List
Subject: [ntdev] IoAllocateAdapterChannel() return STATUS_INSUFFICIENT_RESOURCES?
Hi,
I get a question when I am writing driver for a hypothetical DMA device.
the description of the device is:
DeviceDescription->Version = DEVICE_DESCRIPTION_VERSION;
DeviceDescription->Master = TRUE; // bus master.
DeviceDescription->ScatterGather = FALSE; // no scatter/gather for slave
DeviceDescription->Dma32BitAddresses = TRUE; // capable of decoding 32-bit DMA
DeviceDescription->BusNumber = 0;
DeviceDescription->InterfaceType = PCIBus;
DeviceDescription->MaximumLength = 102400;
I get the Adapter object using HalGetAdapter( ), and the NmberOfMaxRgister returns 8.
Later in the StartIo routine, I call IoAllocateAdapterChannel( ) with the NumberOfMapRegistersNeeded = 3. But IoAllocateAdapterChannel() return STATUS_INSUFFICIENT_RESOURCES. However, the Callback rouine, usually known Adapter control rouine, is called.
No any other rouine is calling IoAllocateAdapterChannel() at same time.
Quoted from DDK Document:
“IoAllocateAdapterChannel prepares the system for a DMA operation on behalf of the target device object. As soon as the appropriate DMA channel and/or any necessary map registers are available, IoAllocateAdapterChannel calls a driver-supplied routine to carry out an I/O operation through the system DMA controller or a busmaster adapter.”
Because the NumberOfMapRegistersNeeded is less than NmberOfMaxRgister renturned by HalGetAdapter(), the IoAllocateAdapterChannel() should not return STATUS_INSUFFICIENT_RESOURCES.
And, if the the IoAllocateAdapterChannel() fail, the Adapter control rouine should not be called. But in my case, it is called.
Could any one give me some hits what is happend inside when IoAllocateAdapterChannel() was called.
Thanks very much.
Jian
You are currently subscribed to ntdev as: xxxxx@broadstor.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
You are currently subscribed to ntdev as: xxxxx@yahoo.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com