power control

  • Thread starter Thread starter Jack Chen
  • Start date Start date
J

Jack Chen

Our comany designing UMPC, for some reseans, our hardware platform does not
support the power control interface, so, when we power off the
XP("start"->"turn off computer"->"turn off"), there will be a final screen
indicating the power can be cut off now, but we want the UMPC cut off itself
automatically, so, I want to ask some questions:
1) If we add an MCU(e.g. 8051) to cut off the power, how can the MCU check
out when to cut the power off?
2) we have an idea that we write an application to detect the power off
signal, when it get that signal, it send messages to the MCU through UART,
and then the MCU start to delay some time and cut off the power, but how long
to delay?

any other idea is appreciated, thanks in advanced.
 
Jack said:
Our comany designing UMPC, for some reseans, our hardware platform does not
support the power control interface, so, when we power off the
XP("start"->"turn off computer"->"turn off"), there will be a final screen
indicating the power can be cut off now, but we want the UMPC cut off itself
automatically, so, I want to ask some questions:
1) If we add an MCU(e.g. 8051) to cut off the power, how can the MCU check
out when to cut the power off?
2) we have an idea that we write an application to detect the power off
signal, when it get that signal, it send messages to the MCU through UART,
and then the MCU start to delay some time and cut off the power, but how long
to delay?

any other idea is appreciated, thanks in advanced.


See "Error Message: When you attempt to shut down your computer, the system
hangs and displays the following message: "It is now safe to turn off your computer"

http://www.smartcomputing.com/editorial/article.asp?article=articles/archive/r0803/07r03/07r03.asp

If ACPI is not working or not supported by the hardware, try APM.

Paul
 
But the Error Message means nothing to the MCU, it can't read the message. I
want some hardware signal that can be use to "make usre" the XP has finish
its work and the power can be cut off, and that hardware signal can be detet
by my MCU.
 
Jack said:
But the Error Message means nothing to the MCU, it can't read the message. I
want some hardware signal that can be use to "make usre" the XP has finish
its work and the power can be cut off, and that hardware signal can be detet
by my MCU.

So you're saying then, that your hardware conforms to no standards.

How did you manage to get Windows to boot on it ?

It makes it easier to answer the question, if you know
what part of your hardware is recognized, and then
work with that interface to achieve your goals.

Paul
 
well, I just want to know is there any hardware signal I can use to decide
when to cut off the power.
 
Jack said:
well, I just want to know is there any hardware signal I can use to decide
when to cut off the power.

I can see mention of Winlogon and GINA having something to do with
shutdown and poweroff. But nothing more detailed than that. But if
you're not careful, and try to hook some of that stuff, antivirus
software may detect what you're doing and declare a false positive.
(In other words, if you find an unofficial solution, it could
have side effects visible to the user.)

If you don't want to implement a proper APM or ACPI BIOS for your
hardware, you could consider the options that Windows has at its
disposal when the system is shutting down.

1) At some point, the operating system decides it is no longer
going to write to disk. It dismounts the disk and flushes
the hardware cache on the disk. But that isn't particularly
useful as a trigger.

2) When the "It is now safe to turn off your computer" appears,
there are a couple options for the processor. Windows could
place the processor in a short loop, like 1:NOOP, GOTO1. A short
loop like that, runs the CPU at 100% load, and makes the processor
hot. You could check to see what address the processor last
accessed, to get some idea what code is the last to execute.

The other possibility, is the Windows code could execute a HALT
instruction. But HALT is also used during normal system operation.
The Windows scheduler issues a HALT, when no tasks are ready to run.
The "clock tick interrupt" wakes the system from HALT, and this scheme
is responsible for the low operating power of an idle system.

Now, if the system was to issue HALT, but turned off the hardware
that implements the clock tick interrupt, then that HALT would
last until the hardware is reset.

Check your hardware while "It is now safe to turn off your computer"
is visible, and see what facilities have been turned off.

With a scheme based on observations like that, there is also a danger
of reproducing the conditions while the machine is at the BIOS level.

The clock tick interrupt uses different hardware than the RTC clock.
The RTC is still keeping time, so real time clock accuracy is unaffected.
The OS switches to counting clock tick interrupts as a time keeping
mechanism, as long as the OS is running.

Perhaps a Windows programming group has a better answer to your
question, or a forum for embedded systems, if that is what you're
building.

HTH,
Paul
 
Thanks for your kindly reply, paul. I am considering using LPC( Low Pin
Count ) interface now, do you also have some ideas with LPC? when the XP is
powring off, is there something on that bus?
 
Jack said:
Thanks for your kindly reply, paul. I am considering using LPC( Low Pin
Count ) interface now, do you also have some ideas with LPC? when the XP is
powring off, is there something on that bus?

The issue is not what bus to use, the question is what hook you can
find in Windows to get the information you need.

Other than APM and ACPI, I haven't been able to find anything else along
those lines. The ATX power supply was introduced around 1995, and
standards just after that time, where things like PC98 or PC99.
And even then, there is reference to ACPI taking over from APM.
So if there was a scheme before APM, I don't know what it is.
APM is a BIOS oriented solution, and some BIOS designs did a better
job than others, of supporting necessary functions. ACPI changed
things, to rely less on clever BIOS design, and more on the OS.

http://en.wikipedia.org/wiki/Pc99

If WinXP doesn't know of a method, then it will display the
"It is safe to turn off your computer" picture. Perhaps in the
same way, that a computer with an AT power supply would (no
PS_ON# signal).

I did find one other means for an interface between your hardware
and the OS. If your hardware could drive the SMI signal, it could
take control of the processor at regular intervals. This article
describes System Management Mode, where the OS is transparently
interrupted, the OS state is stacked, and some other code runs.
Using this method, you could install some code in Windows, which
examines some part of Windows. Then, all you'd need to do, is find
an API in Windows that interfaces into APM, and check some APM
variable that keeps track of the power state. If the APM subsystem
thinks the computer is shut off, then the SMI routine could have
some hardware specific code to turn the power off.

http://www.phrack.com/issues.html?issue=65&id=7&page=1

That kind of method looks complicated, but is probably less work
than writing your own APM or ACPI compliant BIOS.

Paul
 
Back
Top