Hi,
after a lot of try and error with this 1394 Bus I/O Request, I finally
success to have a post notification AllocateAddressRange. But no matter
how many Bytes I sent using the AsyncWrite Request. I only get the first
4 Bytes right and the Rest is 0.
My Callback Function is:
VOID
t1394Diag_DriverNotificationRoutine(
IN PNOTIFICATION_INFO notificationinfo
)
{
PDEVICE_EXTENSION deviceExtension;
KIRQL Irql;
PWAIT_IRP WaitIrp = NULL;
PDRIVER_CANCEL prevCancel = NULL;
PIRP Irp;
PMDL mdl;
PVOID buffer;
PGET_ADDRESS_DATA Data;
ULONG i;
ULONG k;
//PIRP nfyirp;
if (notificationinfo->Mdl) {
deviceExtension = (PDEVICE_EXTENSION)notificationinfo->Context;
KeAcquireSpinLock(&deviceExtension->WaitSpinLock, &Irql);
while (!IsListEmpty(&deviceExtension->WaitIrps)) {
WaitIrp = (PWAIT_IRP)RemoveHeadList(&deviceExtension->WaitIrps);
prevCancel = IoSetCancelRoutine(WaitIrp->Irp, NULL);
mdl=IoAllocateMdl(
MmGetMdlVirtualAddress(notificationinfo->Mdl),
notificationinfo->nLength,
FALSE,
FALSE,
NULL
);
IoBuildPartialMdl(
notificationinfo->Mdl,
mdl,
((PULONG)MmGetMdlVirtualAddress(notificationinfo->Mdl))+notificationinfo->ulOffset,
notificationinfo->nLength
);
*(PULONG)WaitIrp->Irp->AssociatedIrp.SystemBuffer =
*(PULONG)MmGetSystemAddressForMdl(mdl);
WaitIrp->Irp->IoStatus.Information = notificationinfo->nLength;
WaitIrp->Irp->IoStatus.Status = STATUS_SUCCESS;
IoCompleteRequest(WaitIrp->Irp,IO_NO_INCREMENT);
ExFreePool(WaitIrp);
}
KeReleaseSpinLock(&deviceExtension->WaitSpinLock,Irql);
}
}
Can Somebody tell me what is wrong with my code or how to extract data
from a Mdl?
Regards,
Ie Piu
> after a lot of try and error with this 1394 Bus I/O Request, I finally
success to have a post notification AllocateAddressRange. But no matter
how many Bytes I sent using the AsyncWrite Request. I only get the first
4 Bytes right and the Rest is 0.
My Callback Function is:
Why not do the following:
- allocate a MDL in START_DEVICE
- get a system address for it and remember it in the device extension
- pass it to 1394bus in AllocateAddressRange (also in START_DEVICE).
- in the notification routine called by 1394bus, get the MDL’s system
address from the device extension and then copy the data from this address
to the IRP’s SystemBuffer.
- be sure no 1394 packets will arrive during all of this - they will be
delivered to 1394bus by the DpcForIsr routine of the ohci1394 driver and
will overwrite your MDL with something new.
No IoBuildPartialMdl stuff at all.
Max
Hi,
Thanks for your Reply,
Why not do the following:
- allocate a MDL in START_DEVICE
- get a system address for it and remember it in the device extension
- pass it to 1394bus in AllocateAddressRange (also in START_DEVICE).
- in the notification routine called by 1394bus, get the MDL’s system
address from the device extension and then copy the data from this address
to the IRP’s SystemBuffer.
- be sure no 1394 packets will arrive during all of this - they will be
delivered to 1394bus by the DpcForIsr routine of the ohci1394 driver and
will overwrite your MDL with something new.
Same things happen with your version of code (I mean, I only recieved the
first 4 bytes right).anyway, Can you tell me ,how do you allocate a Mdl ?
“Maxim S. Shatskih” wrote:
> after a lot of try and error with this 1394 Bus I/O Request, I finally
> success to have a post notification AllocateAddressRange. But no matter
> how many Bytes I sent using the AsyncWrite Request. I only get the first
> 4 Bytes right and the Rest is 0.
> My Callback Function is:
Why not do the following:
- allocate a MDL in START_DEVICE
- get a system address for it and remember it in the device extension
- pass it to 1394bus in AllocateAddressRange (also in START_DEVICE).
- in the notification routine called by 1394bus, get the MDL’s system
address from the device extension and then copy the data from this address
to the IRP’s SystemBuffer.
- be sure no 1394 packets will arrive during all of this - they will be
delivered to 1394bus by the DpcForIsr routine of the ohci1394 driver and
will overwrite your MDL with something new.
No IoBuildPartialMdl stuff at all.
Max
You are currently subscribed to ntdev as: xxxxx@fokus.gmd.de
To unsubscribe send a blank email to $subst(‘Email.Unsub’)
Hello Max,
If the data buffer I want to transfer and its size are different every time,
what should I do? Create another buffer which is large enough and copy data
to/from this buffer?
Thanks
James
-----Original Message-----
From: Maxim S. Shatskih [mailto:xxxxx@storagecraft.com]
Sent: Wednesday, August 30, 2000 9:32 PM
To: NT Developers Interest List
Subject: [ntdev] Re: AllocateAddressRange
after a lot of try and error with this 1394 Bus I/O Request, I finally
success to have a post notification AllocateAddressRange. But no matter
how many Bytes I sent using the AsyncWrite Request. I only get the first
4 Bytes right and the Rest is 0.
My Callback Function is:
Why not do the following:
- allocate a MDL in START_DEVICE
- get a system address for it and remember it in the device extension
- pass it to 1394bus in AllocateAddressRange (also in START_DEVICE).
- in the notification routine called by 1394bus, get the MDL’s system
address from the device extension and then copy the data from this address
to the IRP’s SystemBuffer.
- be sure no 1394 packets will arrive during all of this - they will be
delivered to 1394bus by the DpcForIsr routine of the ohci1394 driver and
will overwrite your MDL with something new.
No IoBuildPartialMdl stuff at all.
Max
You are currently subscribed to ntdev as: xxxxx@asia.adaptec.com
To unsubscribe send a blank email to $subst(‘Email.Unsub’)
> Same things happen with your version of code (I mean, I only recieved the
first 4 bytes right).anyway, Can you tell me ,how do you allocate a Mdl ?
Looks like you receive only quadlet writes to your MDL, not block ones.
IIRC there was some option in AllocateAddressRange which allows receiving
block writes.
Max
Hi,
Thanks for your answer,
anyway, I have already solved the problem.
Regards,
Ie Piu
“Maxim S. Shatskih” wrote:
> Same things happen with your version of code (I mean, I only recieved the
> first 4 bytes right).anyway, Can you tell me ,how do you allocate a Mdl ?
Looks like you receive only quadlet writes to your MDL, not block ones.
IIRC there was some option in AllocateAddressRange which allows receiving
block writes.
Max
You are currently subscribed to ntdev as: xxxxx@fokus.gmd.de
To unsubscribe send a blank email to $subst(‘Email.Unsub’)
> Thanks for your answer,
anyway, I have already solved the problem.
And what was it - this is interesting…
Max
Hi,
Actually is really no big deal. if you look at my Code. You will find,
that I cast the Mdl System Address to PULONG. That is why, I only get a
Data in ULONG size(quadlet). And everything will be alright, if you cast
the Mdl System Address to the PCHAR. Althought I don’t really quite
understand, why can I only cast it to the PCHAR???
Regards,
Ie Piu,
nb:
sorry for my poor English.
“Maxim S. Shatskih” wrote:
> Thanks for your answer,
> anyway, I have already solved the problem.
And what was it - this is interesting…
Max
You are currently subscribed to ntdev as: xxxxx@fokus.gmd.de
To unsubscribe send a blank email to $subst(‘Email.Unsub’)