[openfirmware] r1635 - cpu/x86/pc/olpc/via
svn at openfirmware.info
svn at openfirmware.info
Fri Dec 18 17:47:33 CET 2009
Author: wmb
Date: 2009-12-18 17:47:33 +0100 (Fri, 18 Dec 2009)
New Revision: 1635
Modified:
cpu/x86/pc/olpc/via/cstate.fth
Log:
OLPC trac 9917 - Added warning to lid power off and lid-off / lid-on commands
to disable / enable the lid shutdown function.
Modified: cpu/x86/pc/olpc/via/cstate.fth
===================================================================
--- cpu/x86/pc/olpc/via/cstate.fth 2009-12-18 16:34:29 UTC (rev 1634)
+++ cpu/x86/pc/olpc/via/cstate.fth 2009-12-18 16:47:33 UTC (rev 1635)
@@ -32,11 +32,20 @@
false value lid-already-down?
0 value lid-down-time
d# 10000 constant lid-shutdown-ms
+d# 2000 constant lid-warning-ms
+0 value lid-warned?
: ?lid-shutdown ( -- )
lid-down? if
lid-already-down? if
acpi-timer@ lid-down-time - d# 3580 / ( ms )
+
+ dup lid-warning-ms >= lid-warned? 0= and if
+ ." Lid switch is active - Powering off in 8 seconds" cr
+ ." Type lid-off to disable this function" cr
+ true to lid-warned?
+ then ( ms )
+
lid-shutdown-ms >= if
." Powering off after 10 seconds of lid down" cr
power-off
@@ -47,12 +56,18 @@
then
else
false to lid-already-down?
+ false to lid-warned?
then
;
+defer do-lid
+: lid-on ( -- ) ['] ?lid-shutdown to do-lid ;
+: lid-off ( -- ) ['] noop to do-lid ;
+lid-on
+
defer do-idle ' noop to do-idle
-: safe-idle ( -- ) can-idle? if do-idle then ?lid-shutdown ;
+: safe-idle ( -- ) can-idle? if do-idle then do-lid ;
' safe-idle to stdin-idle
alias c1-idle halt
More information about the openfirmware
mailing list