Changeset 2991


Ignore:
Timestamp:
May 31, 2012, 8:47:17 AM (3 years ago)
Author:
quozl
Message:

OLPC - lid close consistent across models, made into common code, #11095

Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • cpu/arm/olpc/1.75/switches.fth

    r2573 r2991  
    3737;
    3838
    39 false value lid-already-down?
    40 0 value lid-down-time
    41 d# 10000 constant lid-shutdown-ms
    42 d#  2000 constant lid-warning-ms
    43 0 value lid-warned?
    44 
    45 : ?lid-shutdown  ( -- )
    46    lid?  if
    47       lid-already-down?  if
    48          get-msecs lid-down-time -               ( ms )
    49 
    50          dup lid-warning-ms >=  lid-warned? 0=  and  if
    51             ." Lid switch is active - Powering off in 8 seconds" cr
    52             ." Type  lid-off  to disable this function" cr
    53             true to lid-warned?
    54          then                                    ( ms )
    55 
    56          lid-shutdown-ms >=  if
    57             ." Powering off after 10 seconds of lid down" cr
    58             power-off
    59          then
    60       else
    61          get-msecs to lid-down-time
    62          true to lid-already-down?
    63       then
    64    else
    65       false to lid-already-down?
    66       false to lid-warned?
    67    then
    68 ;
    69 : lid-on  ( -- )  ['] ?lid-shutdown to do-lid  ;
    70 ' lid-on to do-lid
    71 
     39fload ${BP}/dev/olpc/lid.fth
    7240end-package
    7341
  • cpu/x86/pc/olpc/fw.bth

    r2987 r2991  
    480480" dhcp" ' ip-address  set-config-string-default
    481481
    482 : c1-idle  ( -- )  interrupts-enabled?  if  halt  then  ;
     482: lid?  ( -- flag )  h# 30 >hi gpio@  h# 400 and 0=  ;
     483fload ${BP}/dev/olpc/lid.fth
     484
     485: c1-idle  ( -- )  interrupts-enabled?  if  halt  then  do-lid  ;
    483486' c1-idle to stdin-idle
    484487
  • cpu/x86/pc/olpc/via/cstate.fth

    r2865 r2991  
    2929;
    3030
    31 : lid-down?  ( -- flag )  h# 48 acpi-l@ h# 80 and 0=  ;
    32 false value lid-already-down?
    33 0 value lid-down-time
    34 d# 10000 constant lid-shutdown-ms
    35 d#  2000 constant lid-warning-ms
    36 0 value lid-warned?
    37 
    38 : ?lid-shutdown  ( -- )
    39    lid-down?  if
    40       lid-already-down?  if
    41          acpi-timer@ lid-down-time -  d# 3580 /  ( ms )
    42 
    43          dup lid-warning-ms >=  lid-warned? 0=  and  if
    44             ." Lid switch is active - Powering off in 8 seconds" cr
    45             ." Type  lid-off  to disable this function" cr
    46             true to lid-warned?
    47          then                                    ( ms )
    48 
    49          lid-shutdown-ms >=  if
    50             ." Powering off after 10 seconds of lid down" cr
    51             power-off
    52          then
    53       else
    54          acpi-timer@ to lid-down-time
    55          true to lid-already-down?
    56       then
    57    else
    58       false to lid-already-down?
    59       false to lid-warned?
    60    then
    61 ;
    62 
    63 defer do-lid
    64 : lid-on  ( -- )  ['] ?lid-shutdown to do-lid  ;
    65 : lid-off ( -- )  ['] noop to do-lid  ;
    66 lid-on
     31: lid?  ( -- flag )  h# 48 acpi-l@ h# 80 and 0=  ;
     32fload ${BP}/dev/olpc/lid.fth
    6733
    6834defer do-idle  ' noop to do-idle
Note: See TracChangeset for help on using the changeset viewer.