Re: Thread in driver
- From: Valter Minute <v_a_l_t_e_r.m_i_n_u_t_e@xxxxxxxxxxxxx>
- Date: Fri, 11 Apr 2008 01:01:53 -0700
winstonhyypia@xxxxxxxxx wrote in
news:12efb42e-b16b-4920-a82b-a87763e0298a@xxxxxxxxxxxxxxxxxxxxxxxxxxx
:
Actually I would like to create a driver which I can pass a
function pointer in. And the driver is able to do the callback
whenever there is an interrupt. Here is my program...
This kind of solution will work only if your callback is inside
another driver (and in CE 6.0 both driver must be kernel mode drivers
or user mode driver of the same "group" and so running inside the same
process).
If you do that calling your driver from an application the callback
code will not be mapped inside the context of the caller (unless you
are in CE 5.0 and the code is inside a DLL that is shared by the
driver and the process) and, anyway, it will run in the context of the
caller process (device.exe in CE 5, the kernel or user-mode device
process in CE 6) and so it won't be able to access your process
memory.
If you need to implement such a mechanism, use a named event and set
it inside the IST. The app will spin a thread that will wait on the
same event and perform the operations that the callback was supposed
to perform when the event is set (you can call your current callback
inside the thread to reduce code changes).
If you need to way for the callback completition before you can accept
a new interrupt you can use another named event that the app will set
and the driver will wait on.
If you need to exchange data between the IST and your app you have a
wide choice of solutions: shared memory block, a IOCTL implemented by
the driver to return information stored inside the IST, a point-to-
point message queue (in this case you won't need the named event
because the queue can be use to synchronize the IST thread and the
application thread.
--
Valter Minute
www.fortechembeddedlabs.it
Training, support and development for Windows CE
(the reply address of this message is invalid)
.
- Follow-Ups:
- Re: Thread in driver
- From: Winston
- Re: Thread in driver
- References:
- Thread in driver
- From: winstonhyypia
- Thread in driver
- Prev by Date: Re: TTS Application using SAPI
- Next by Date: PXA not wakeup after suspen..
- Previous by thread: Re: Thread in driver
- Next by thread: Re: Thread in driver
- Index(es):
Relevant Pages
|