- question about USBCAMD
- Posted by slchang on June 9th, 2005
Hi all,
I implement USB 2.0 camera driver on XP with USBCAMD DDK.
Sometime, I observe that USBCAMD_IntOrBulkTransfer( ) will excute after
USBCAMD_StopChannel( ), when I restart PC without close AP(Amcap 8.0). And
my driver can't transfer correct data bcz timeout after reboot. BUT if I use
Amcap 9.0, there is no any transfer after USBCAMD_StopChannel( ), and driver
work well.
My question is:
USBCAMD_IntOrBulkTransfer( ) can be excute after USBCAMD_StopChannel( ) ? If
not, how should I avoid this problem.
thanks.
- Posted by slchang on June 16th, 2005
Maybe I can get the answer in http://www.wd-3.com/archive/WalkPlank.htm
- Posted by slchang on June 17th, 2005
Now I have another problem.
USBCAMD have some structure ex: DeviceExtension, ChannelExtension, Srb,
DeviceContext...etc
How can I get the DeviceObject for calling IoAllocateWorkItem() ?
Which DeviceObject is really I need ?
I can't discriminate the difference between them very clearly.
Any help or hint would be very much appreciated !
- Posted by Tim Roberts on June 19th, 2005
"slchang" <slchang@sq.com.tw> wrote:
The DeviceContext that gets passed to all of the callbacks is a structure
completely under your control. Just tuck the device object into an element
of that structure, and it's always there for you.
--
- Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc
- Posted by slchang on June 20th, 2005
Thank for your reply.
Seem I can't access field in DeviceContext directly.
Maybe I can use DeviceExtension to get DeviceObject.
Although there three DeviceObject variable inside DeviceExtension, I will
try it !
- Posted by Tim Roberts on June 21st, 2005
"slchang" <slchang@sq.com.tw> wrote:
Of course you can. Which callback are you in that you believe you can't
get to the DeviceContext?
--
- Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc
- Posted by slchang on June 21st, 2005
I can't use it directly because DeviceContext is PVOID type in USBCAMD
layer.
DeviceContext's data structure is defined in USBINTEL layer.
Of Course I can make something change for using DeviceContext.
But I don't want to modify the framework if I have other choice.
Any good idea?
- Posted by Tim Roberts on June 25th, 2005
"slchang" <slchang@sq.com.tw> wrote:
USBINTEL is not a "layer". That's the driver. The DriverContext belongs
entirely to your driver. All you have to do is cast the PVOID to a pointer
to your DeviceContext structure. It belongs entirely to you.
--
- Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc
- Posted by slchang on June 27th, 2005
Example:
USBCAMD_MyRoutine(
IN PVOID DeviceContext,
....
)
{
// case 1
PINTELCAM_DEVICE_CONTEXT MyDeviceContext; // error:
'PINTELCAM_DEVICE_CONTEXT' undeclared identifier
....
// case 2
WorkItem = IoAllocateWorkItem(DeviceContext->pDeviceObject); //
error : left of '->pDeviceObject' must point to struct/union
....
}
Maybe "layer" is not appropriate word.
But problem is:
In case 1, I can't use the data type bcz it's defined in USBINTEL "driver",
not USBCAMD "driver".
In case 2, I can't use pDeviceObject field bcz DeviceContext is PVOID type.
Have anything I forget to do?
- Posted by Tim Roberts on June 28th, 2005
"slchang" <slchang@sq.com.tw> wrote:
Yes, but YOU are modifying the USBINTEL driver to become YOUR driver, in
order to handle YOUR hardware. Your device context is not called
INTELCAM_DEVICE_CONTEXT, but will be some structure that YOU have defined.
You can base it on INTELCAM_DEVICE_CONTEXT, but it will be your own
structure.
You will use MyDeviceContext->pDeviceObject, once you get your own context
structure defined.
--
- Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc
- Posted by slchang on June 28th, 2005
That is, in USBCAMD driver, I must define a structure just copy(or modify)
from USBINTEL driver ?
By the way, there are three deviceobject field in DeviceExtension in
USBCAMD.
No matter which one I pass to IoAllocateWorkItem( ), the driver work.
But I can't prove that walk-plank bug cause by WorkItem being fix on Windows
2000.
Maybe crash by another walk-plank bug, maybe the deviceobject is not correct
one.
Anyway, thanks for your reply.
- Posted by Tim Roberts on June 30th, 2005
"slchang" <slchang@sq.com.tw> wrote:
Every driver has its own context structure. If the one from the USBINTEL
sample satisfies your need, you can use it. You probably want to change
its name, although you don't have to. Eventually, you will want to go
through each member and make sure you actually need it.
Well, the device object you give it will be passed as the first parameter
to the work item routine, so it depends on what you need in there. For
most purposes, you probably want to use the pDeviceObject, not the
pPnPDeviceObject.
--
- Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc