[openfirmware] [commit] r2227 - cpu/arm/olpc/1.75

repository service svn at openfirmware.info
Thu May 26 02:16:33 CEST 2011


Author: wmb
Date: Thu May 26 02:16:32 2011
New Revision: 2227
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2227

Log:
OLPC trac #10889 and #10890 - Added LEDs and switches selftests to XO-1.75.

Added:
   cpu/arm/olpc/1.75/leds.fth
   cpu/arm/olpc/1.75/switches.fth
Modified:
   cpu/arm/olpc/1.75/fw.bth

Modified: cpu/arm/olpc/1.75/fw.bth
==============================================================================
--- cpu/arm/olpc/1.75/fw.bth	Thu May 26 01:56:39 2011	(r2226)
+++ cpu/arm/olpc/1.75/fw.bth	Thu May 26 02:16:32 2011	(r2227)
@@ -146,6 +146,10 @@
 fload ${BP}/cpu/x86/pc/olpc/plot.fth
 fload ${BP}/cpu/arm/olpc/1.75/testinstructions.fth
 
+fload ${BP}/cpu/arm/olpc/1.75/switches.fth \ Lid and ebook switches
+fload ${BP}/cpu/arm/olpc/1.75/leds.fth     \ LEDs
+\ fload ${BP}/cpu/x86/pc/olpc/via/factory.fth  \ Manufacturing tools
+
 \ Pseudo device that appears in the boot order before net booting
 0 0 " " " /" begin-package
    " prober" device-name

Added: cpu/arm/olpc/1.75/leds.fth
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ cpu/arm/olpc/1.75/leds.fth	Thu May 26 02:16:32 2011	(r2227)
@@ -0,0 +1,42 @@
+\ See license at end of file
+purpose: Driver/selftest for OLPC XO-1.75 LEDs
+
+0 0  " 0"  " /" begin-package
+0 0 reg  \ So test-all will run the test
+" leds" device-name
+: open  ( -- okay? )  true  ;
+: close  ( -- )  ;
+: hdd-led-on  ( -- )  d# 10 gpio-set  ;
+: hdd-led-off ( -- )  d# 10 gpio-clr  ;
+: selftest  ( -- )
+   ." Flashing LEDs" cr
+   " /wlan" test-dev  " /wlan" test-dev  \ Twice for longer flashing
+   d# 20 0 do  hdd-led-on d# 100 ms hdd-led-off d# 100 ms  loop
+   confirm-selftest?
+;
+
+end-package
+
+\ LICENSE_BEGIN
+\ Copyright (c) 2011 FirmWorks
+\ 
+\ Permission is hereby granted, free of charge, to any person obtaining
+\ a copy of this software and associated documentation files (the
+\ "Software"), to deal in the Software without restriction, including
+\ without limitation the rights to use, copy, modify, merge, publish,
+\ distribute, sublicense, and/or sell copies of the Software, and to
+\ permit persons to whom the Software is furnished to do so, subject to
+\ the following conditions:
+\ 
+\ The above copyright notice and this permission notice shall be
+\ included in all copies or substantial portions of the Software.
+\ 
+\ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+\ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+\ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+\ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+\ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+\ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+\ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+\
+\ LICENSE_END

Added: cpu/arm/olpc/1.75/switches.fth
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ cpu/arm/olpc/1.75/switches.fth	Thu May 26 02:16:32 2011	(r2227)
@@ -0,0 +1,63 @@
+\ See license at end of file
+purpose: Driver/selftest for OLPC lid and ebook switches
+
+0 0  " 0"  " /" begin-package
+" switches" device-name
+0 0 reg  \ So test-all will run the test
+: open  ( -- okay? )  true  ;
+: close  ( -- )  ;
+: lid?    ( -- flag )  d# 129 gpio-pin@  0=  ;
+: ebook?  ( -- flag )  d# 128 gpio-pin@  0=  ;
+
+: ?key-abort  ( -- )  key?  if  key esc =  abort" Aborted"  then  ;
+: wait-not-lid  ( -- )
+   ." Deactivate lid switch" cr
+   begin  ?key-abort  lid? 0=  until
+;
+: wait-lid  ( -- )
+   ." Activate lid switch" cr
+   begin  ?key-abort  lid? until
+;
+: wait-not-ebook  ( -- )
+   ." Deactivate ebook switch" cr
+   begin  ?key-abort  ebook? 0=  until
+;
+: wait-ebook  ( -- )
+   ." Activate ebook switch" cr
+   begin  ?key-abort  ebook? until
+;
+
+: all-switch-states  ( -- )
+   lid?  if  wait-not-lid  else  wait-lid  then
+   ebook?  if  wait-not-ebook  else  wait-ebook  then
+;
+
+: selftest  ( -- error? )
+   ['] all-switch-states catch
+;
+
+end-package
+
+\ LICENSE_BEGIN
+\ Copyright (c) 2011 FirmWorks
+\ 
+\ Permission is hereby granted, free of charge, to any person obtaining
+\ a copy of this software and associated documentation files (the
+\ "Software"), to deal in the Software without restriction, including
+\ without limitation the rights to use, copy, modify, merge, publish,
+\ distribute, sublicense, and/or sell copies of the Software, and to
+\ permit persons to whom the Software is furnished to do so, subject to
+\ the following conditions:
+\ 
+\ The above copyright notice and this permission notice shall be
+\ included in all copies or substantial portions of the Software.
+\ 
+\ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+\ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+\ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+\ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+\ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+\ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+\ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+\
+\ LICENSE_END



More information about the openfirmware mailing list