I want to wrote a SSP driver.Because both the kbd driver
and the battery driver would call it for transfer by SSP.
So I build it in drvlib.lib and link to kbd and batt driver.
Of cause,to prevent access conflict,I use MUTEX in SSP driver.

All works well.
But When I resume system from suspend,the system halting....

I found that when system resume,If system call some register
such as SSP_REGS in SSP driver and the exception occur.The register
(SSP_REGS)is defined and intialized in SSP driver.

When system boot,the SSP intilize and memory alloc function
would be called twice in kbd and batt driver.there is no exception
occur.

(I called the SSP iniilize and memory alloc function in PowerHandle
function in kbd and batt driver.)

It seems that it`s a memory access violation......
So,
How can I do with PowerHandle function in kbd and batt driver?

Thank you.

Re: Two drivers called one common code cause system halt when sysetem resume... by bc

bc
Sat Dec 31 01:27:54 CST 2005

I suggest you create a ssp driver(dll), a genuine driver, but not a dot lib.
In ssp driver, we could use EnterCriticalSection to protect "read ssp" and
"write ssp" for a atom operation.
I guess you work on one same IC for keypad and battery drivers, so you could
code a IC driver for them. In IC driver, you could judge the initializtion
number and process them.

Good Luck :)

"cool_harber" <cool_harber@hotmail.com> wrote in message
news:OkoHT%23UDGHA.272@TK2MSFTNGP10.phx.gbl...
>I want to wrote a SSP driver.Because both the kbd driver
> and the battery driver would call it for transfer by SSP.
> So I build it in drvlib.lib and link to kbd and batt driver.
> Of cause,to prevent access conflict,I use MUTEX in SSP driver.
>
> All works well.
> But When I resume system from suspend,the system halting....
>
> I found that when system resume,If system call some register
> such as SSP_REGS in SSP driver and the exception occur.The register
> (SSP_REGS)is defined and intialized in SSP driver.
>
> When system boot,the SSP intilize and memory alloc function
> would be called twice in kbd and batt driver.there is no exception
> occur.
>
> (I called the SSP iniilize and memory alloc function in PowerHandle
> function in kbd and batt driver.)
>
> It seems that it`s a memory access violation......
> So,
> How can I do with PowerHandle function in kbd and batt driver?
>
> Thank you.



Re: Two drivers called one common code cause system halt when sysetem resume... by mobilevil

mobilevil
Sat Dec 31 05:35:54 CST 2005

i did something similar... and succeed.
only the driver being loaded first will do hardware init and memalloc. the
later driver just skip(if mutex exist)
of course only the first driver deinit when system suspend, and reinit when
system resume.

and in another case, I read battery info in another(audio driver) driver
anyway, and store the info in a memory mapped file. the real battery driver
is a dummy, it just read data from the memory mapped file.


--
-----------------------------------------------------------
ÌØ?eÒª ÌØ?eÒª ÌØ?eÒª kachun µÃ½ð
"cool_harber" <cool_harber@hotmail.com> wrote in message
news:OkoHT%23UDGHA.272@TK2MSFTNGP10.phx.gbl...
>I want to wrote a SSP driver.Because both the kbd driver
> and the battery driver would call it for transfer by SSP.
> So I build it in drvlib.lib and link to kbd and batt driver.
> Of cause,to prevent access conflict,I use MUTEX in SSP driver.
>
> All works well.
> But When I resume system from suspend,the system halting....
>
> I found that when system resume,If system call some register
> such as SSP_REGS in SSP driver and the exception occur.The register
> (SSP_REGS)is defined and intialized in SSP driver.
>
> When system boot,the SSP intilize and memory alloc function
> would be called twice in kbd and batt driver.there is no exception
> occur.
>
> (I called the SSP iniilize and memory alloc function in PowerHandle
> function in kbd and batt driver.)
>
> It seems that it`s a memory access violation......
> So,
> How can I do with PowerHandle function in kbd and batt driver?
>
> Thank you.



Re: Two drivers called one common code cause system halt when sysetem by cool_harber

cool_harber
Sat Dec 31 10:21:06 CST 2005

Thank bc && mobilevil.I`ll try again with your advice.

by the way ,Happy new year to you.

mobilevil дµÀ:
> i did something similar... and succeed.
> only the driver being loaded first will do hardware init and memalloc. the
> later driver just skip(if mutex exist)
> of course only the first driver deinit when system suspend, and reinit when
> system resume.
>
> and in another case, I read battery info in another(audio driver) driver
> anyway, and store the info in a memory mapped file. the real battery driver
> is a dummy, it just read data from the memory mapped file.
>
>

Re: Two drivers called one common code cause system halt when sysetem resume... by Piet

Piet
Mon Jan 02 10:02:58 CST 2006


> I want to wrote a SSP driver.Because both the kbd driver
> and the battery driver would call it for transfer by SSP.
> So I build it in drvlib.lib and link to kbd and batt driver.

You're not making a driver this way. Create your own dll exposing the
stream driver interface, add registry keys so it gets loaded and then
use calls like "CreateFile" from the other drivers.

Do allocations in the SSP_Init function so it is done only once. Make
sure drivers depending on the SSP driver are loaded after it and they
will not have to worry about allocation.

It's a little bit more work than sharing the code but you'll be happier
in the future.

Regards,
Piet