Hi,
I have a pxa270 BSP that was probably ported from Wince5 to CE6.0.
The GPIO driver allows me to set interrupts on a GPIO pin.
But it is not working. After investigating I found that the
InterruptInitialize() in the driver failed with code 87.
I found the following article and implemented this :

http://groups.google.com/group/microsoft.public.windowsce.platbuilder/browse_thread/thread/63a4495704f113af/e11f31bfa5be37c2?lnk=st&q=duplicatehandle+wince#e11f31bfa5be37c2

Now the InterruptInitialize() succeeds (after duplicating the event handle
that was passed from the application), but I still donot see any interrupts.
I use WaitForSingleObject() on the ORIGINAL event-handle, is this the
problem ?
Should I be waiting on the duplicated handle ? in that case I would need to
pass it back to the app first. That makes me wonder if it would be better to
let the Driver instantiate the event in the first place, instead of passing
it twice...

Please advise....

Greetings,
Rob

RE: Duplicatehandle by Rob

Rob
Tue Apr 15 05:11:00 PDT 2008

MSDN says :
This function duplicates an object handle. The duplicate handle refers to
the same object as the original handle. Therefore, any changes to the object
are reflected through both handles.

mmmmmm..... so it should work already.... but it doesn't.....

Greetings,
Rob.




"Rob" wrote:

> Hi,
> I have a pxa270 BSP that was probably ported from Wince5 to CE6.0.
> The GPIO driver allows me to set interrupts on a GPIO pin.
> But it is not working. After investigating I found that the
> InterruptInitialize() in the driver failed with code 87.
> I found the following article and implemented this :
>
> http://groups.google.com/group/microsoft.public.windowsce.platbuilder/browse_thread/thread/63a4495704f113af/e11f31bfa5be37c2?lnk=st&q=duplicatehandle+wince#e11f31bfa5be37c2
>
> Now the InterruptInitialize() succeeds (after duplicating the event handle
> that was passed from the application), but I still donot see any interrupts.
> I use WaitForSingleObject() on the ORIGINAL event-handle, is this the
> problem ?
> Should I be waiting on the duplicated handle ? in that case I would need to
> pass it back to the app first. That makes me wonder if it would be better to
> let the Driver instantiate the event in the first place, instead of passing
> it twice...
>
> Please advise....
>
> Greetings,
> Rob
>
>
>
>

Re: Duplicatehandle by Luca

Luca
Tue Apr 15 05:58:55 PDT 2008

if I am right: you have a GPIO driver which allows an application to say 'i
want that GPIO as an interrupt source';
and you want the driver to communicate to the application that the interrupt
occurred using the handle to the event
which is registered with InterruptInitialize. How are you using
DuplicateHandle? I would pass a handle created by the
application to the driver, the driver would call DuplicateHandle on it and
call SetEvent each time an interrupt occurs.
In CE 6.0 there is a function (CeDriverDuplicateCallerHandle) which serves
for this purpose

--

Luca Calligaris
www.eurotech.it

"Rob" <Rob@discussions.microsoft.com> ha scritto nel messaggio
news:97111A31-A774-4FF4-AFBB-59A8D4AF5799@microsoft.com...
> MSDN says :
> This function duplicates an object handle. The duplicate handle refers to
> the same object as the original handle. Therefore, any changes to the
> object
> are reflected through both handles.
>
> mmmmmm..... so it should work already.... but it doesn't.....
>
> Greetings,
> Rob.
>
>
>
>
> "Rob" wrote:
>
>> Hi,
>> I have a pxa270 BSP that was probably ported from Wince5 to CE6.0.
>> The GPIO driver allows me to set interrupts on a GPIO pin.
>> But it is not working. After investigating I found that the
>> InterruptInitialize() in the driver failed with code 87.
>> I found the following article and implemented this :
>>
>> http://groups.google.com/group/microsoft.public.windowsce.platbuilder/browse_thread/thread/63a4495704f113af/e11f31bfa5be37c2?lnk=st&q=duplicatehandle+wince#e11f31bfa5be37c2
>>
>> Now the InterruptInitialize() succeeds (after duplicating the event
>> handle
>> that was passed from the application), but I still donot see any
>> interrupts.
>> I use WaitForSingleObject() on the ORIGINAL event-handle, is this the
>> problem ?
>> Should I be waiting on the duplicated handle ? in that case I would need
>> to
>> pass it back to the app first. That makes me wonder if it would be better
>> to
>> let the Driver instantiate the event in the first place, instead of
>> passing
>> it twice...
>>
>> Please advise....
>>
>> Greetings,
>> Rob
>>
>>
>>
>>



Re: Duplicatehandle by Rob

Rob
Wed Apr 16 06:34:00 PDT 2008

What you describe is the case...
It was caused by a bug in the BSP.
The supplier fixed it, the cause was that the handle needed to be duplicated
:-)

Greetings,
Rob.


"Luca Calligaris" wrote:

> if I am right: you have a GPIO driver which allows an application to say 'i
> want that GPIO as an interrupt source';
> and you want the driver to communicate to the application that the interrupt
> occurred using the handle to the event
> which is registered with InterruptInitialize. How are you using
> DuplicateHandle? I would pass a handle created by the
> application to the driver, the driver would call DuplicateHandle on it and
> call SetEvent each time an interrupt occurs.
> In CE 6.0 there is a function (CeDriverDuplicateCallerHandle) which serves
> for this purpose
>
> --
>
> Luca Calligaris
> www.eurotech.it
>
> "Rob" <Rob@discussions.microsoft.com> ha scritto nel messaggio
> news:97111A31-A774-4FF4-AFBB-59A8D4AF5799@microsoft.com...
> > MSDN says :
> > This function duplicates an object handle. The duplicate handle refers to
> > the same object as the original handle. Therefore, any changes to the
> > object
> > are reflected through both handles.
> >
> > mmmmmm..... so it should work already.... but it doesn't.....
> >
> > Greetings,
> > Rob.
> >
> >
> >
> >
> > "Rob" wrote:
> >
> >> Hi,
> >> I have a pxa270 BSP that was probably ported from Wince5 to CE6.0.
> >> The GPIO driver allows me to set interrupts on a GPIO pin.
> >> But it is not working. After investigating I found that the
> >> InterruptInitialize() in the driver failed with code 87.
> >> I found the following article and implemented this :
> >>
> >> http://groups.google.com/group/microsoft.public.windowsce.platbuilder/browse_thread/thread/63a4495704f113af/e11f31bfa5be37c2?lnk=st&q=duplicatehandle+wince#e11f31bfa5be37c2
> >>
> >> Now the InterruptInitialize() succeeds (after duplicating the event
> >> handle
> >> that was passed from the application), but I still donot see any
> >> interrupts.
> >> I use WaitForSingleObject() on the ORIGINAL event-handle, is this the
> >> problem ?
> >> Should I be waiting on the duplicated handle ? in that case I would need
> >> to
> >> pass it back to the app first. That makes me wonder if it would be better
> >> to
> >> let the Driver instantiate the event in the first place, instead of
> >> passing
> >> it twice...
> >>
> >> Please advise....
> >>
> >> Greetings,
> >> Rob
> >>
> >>
> >>
> >>
>
>
>