Re: IST in C# application

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hi Oleg,

I think that your advice using DeviceIoControl() is related with
reentrant routines, as far as I know.

What about using critical sections in custom functions exported by the
driver?

The current driver (which was not developed by me) is doing that with
the other GPIOs functions.

Best regards,

Alex


On Nov 12, 11:47 am, voidcoder <voidco...@xxxxxxxxx> wrote:
>> So, instead of an extra native dll, I think that I can export that
>> function directly from the driver.

Good choice! Just note that you can't export any functions
from the driver, you have to use DeviceIoControl() API to
call into it:

http://msdn2.microsoft.com/en-us/library/ms898288.aspx

Actually you can export functions from the driver .DLL
by loading it into app address space but it is a totally
different thing so DeviceIoControl() is your friend.

--
Oleg



alexqu...@xxxxxxxxxxxx wrote:
Hi,

thanks for your replies.

I already have a GPIO driver which exports the functions to define
direction, write and read. I am extending it to support the IRQs
functionality.

So, instead of an extra native dll, I think that I can export that
function directly from the driver.

Some of the GPIOs that I have to control are coming from the UCB1400.
I do not want to handle the IRQ source identification in the ISR (to
avoid performance problems), but in an IST in the GPIO driver: So, I
have to define a procedure that lets the C# application to register
the IRQ with the IST of the GPIO.

I think named events and EventWaitHandle/WaitOne() (in the C# side)
are the way to go.

Thanks,

Alex

On Nov 10, 2:39 am, voidcoder <voidco...@xxxxxxxxx> wrote:
It seems you've got a lot of suggestions :) I'd personally
vote for Dean's method too. There is a great article on
MSDN by Michel Verhagen and Maarten Struys demonstrating
exactly this approach. Actually it is about CF real-time
capabilities but still could be useful for you:

http://msdn2.microsoft.com/en-us/library/ms836789.aspx

But note this is not going to work on 6.0! If you have
in mind supporting this on 6.0 you'd better move
interrupt handling into a separate driver, otherwise
it will come back to bite you when migrating to 6.0...

--
Oleg

alexqu...@xxxxxxxxxxxx wrote:
Hi Dean,
that sounds interesting. I'll check it.
Thanks,
Alex
On Nov 9, 3:13 pm, "Dean Ramsier" <ramsiernos...@xxxxxxxxxx> wrote:
Put it in a native dll, and provide a wrapper for them to access from
managed code. It will be a lot easier on them (fewer/less complex pInvoke)
and better performance.
--
Dean Ramsier - eMVP
BSQUARE Corporation
<alexqu...@xxxxxxxxxxxx> wrote in message
news:1194612137.380197.127710@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi Oleg,
What is the reason for moving driver's job into application?
well, I found that way easer (in theory) than creating callbacks or
whatever I can use to notify the C# application that it has to handle
the interrupt event.
They just want to have control of those lines via a C# API.
I am just planning the concept (that means, I'm writing the API
signatures), so I am open to here sugestions.
We don't know their plans for those GPIO/IRQs in future and they want
that encapsulated to be used in their C# application.
Thanks,
Alex
On Nov 9, 12:10 pm, voidcoder <voidco...@xxxxxxxxx> wrote:
What is the reason for moving driver's job into application?
Realtime? There can't be any talk about realtime in managed
code ...
Anyway, it is not a standard way to handle interrupts
so not likely there is a .NET framework for that.
P/ invoking is your friend, there shouldn't be any
problem (at least CE 5 and below) for handling interrupts
in C# app.
--
Oleg
alexqu...@xxxxxxxxxxxx wrote:
Hi,
one user of our device wants to handle some of the interrupts (unused
GPIOs that can be configured as IRQ) direct from his application
written in C#.
I am not a expert in .NET CF, so I hope that someone could give me
some advice to emulate the normal way to do so (CreateEvent,
InterruptInitialize, CreateThread and so on) but under C#. I think P/
invoking all these C functions won't be very elegant...
Thanks in advance.
Alex- Hide quoted text -
- Show quoted text -- Hide quoted text -
- Show quoted text -- Hide quoted text -
- Show quoted text -- Hide quoted text -

- Show quoted text -


.



Relevant Pages