Author: wmb Date: 2009-09-18 03:19:07 +0200 (Fri, 18 Sep 2009) New Revision: 1369
Added: dev/hdaudio/test.fth dev/olpc/confirm.fth Modified: cpu/x86/pc/olpc/via/devices.fth cpu/x86/pc/olpc/via/mfgtest.fth dev/geode/ac97/selftest.fth dev/hdaudio/core.fth dev/hdaudio/hdaudio.bth dev/libertas.fth dev/olpc/dcon/viadcon.fth dev/olpc/kb3700/battery.fth dev/olpc/keyboard/selftest.fth dev/olpc/touchpad/touchpad.fth dev/olpc/viacamera/camera.fth Log: OLPC Via - big batch of selftest improvments to make test-all more suitable for the "SMT test" phase of manufacturing.
Modified: cpu/x86/pc/olpc/via/devices.fth =================================================================== --- cpu/x86/pc/olpc/via/devices.fth 2009-09-18 01:15:46 UTC (rev 1368) +++ cpu/x86/pc/olpc/via/devices.fth 2009-09-18 01:19:07 UTC (rev 1369) @@ -119,6 +119,7 @@ fload ${BP}/dev/16550pkg/16550.fth \ Serial port support package end-support-package [then] +: serial-enabled? ( -- flag ) h# 8846 config-b@ h# 40 and 0<> ;
fload ${BP}/dev/pci/isaall.fth \ We don't need a serial selftest because the serial port is internal only @@ -262,6 +263,7 @@ atest? 0= if wlan-reset then ;
+fload ${BP}/dev/olpc/confirm.fth \ Selftest interaction modalities fload ${BP}/cpu/x86/pc/olpc/mfgdata.fth \ Manufacturing data fload ${BP}/cpu/x86/pc/olpc/mfgtree.fth \ Manufacturing data in device tree fload ${BP}/cpu/x86/pc/olpc/kbdtype.fth \ Export keyboard type
Modified: cpu/x86/pc/olpc/via/mfgtest.fth =================================================================== --- cpu/x86/pc/olpc/via/mfgtest.fth 2009-09-18 01:15:46 UTC (rev 1368) +++ cpu/x86/pc/olpc/via/mfgtest.fth 2009-09-18 01:19:07 UTC (rev 1369) @@ -104,8 +104,8 @@ : camera-item ( -- ) " /camera" mfg-test-dev ; : wlan-item ( -- ) " /wlan" mfg-test-dev ; : timer-item ( -- ) " /timer" mfg-test-dev ; -: touchpad-item ( -- ) " /mouse" mfg-test-dev ; -: keyboard-item ( -- ) " /keyboard" mfg-test-dev ; +: touchpad-item ( -- ) " /8042/mouse" mfg-test-dev ; +: keyboard-item ( -- ) " /8042/keyboard" mfg-test-dev ;
: mfgtest-menu ( -- ) clear-menu @@ -125,11 +125,11 @@ " RAM chips" ['] memory-item ram.icon 1 2 install-icon
- " SD card controllers - internal and external mass storage" + " Internal mass storage" ['] sd-item sdcard.icon 1 3 install-icon
- " USB ports" - ['] usb-item usb.icon 1 4 install-icon + " Plug-in SD card" + ['] sd-item sdcard.icon 1 4 install-icon
" Battery" ['] battery-item battery.icon 2 0 install-icon @@ -149,8 +149,8 @@ " RTC (Real-Time Clock)" ['] rtc-item clock.icon 3 0 install-icon
- " ISA Timer" - ['] timer-item timer.icon 3 1 install-icon + " USB ports" + ['] usb-item usb.icon 3 1 install-icon
\ These are last because they require user participation. \ The earlier tests are all included in automatic batch-mode. @@ -160,7 +160,6 @@
" Touchpad" ['] touchpad-item touchpad.icon 3 3 install-icon - ;
' mfgtest-menu to root-menu
Modified: dev/geode/ac97/selftest.fth =================================================================== --- dev/geode/ac97/selftest.fth 2009-09-18 01:15:46 UTC (rev 1368) +++ dev/geode/ac97/selftest.fth 2009-09-18 01:19:07 UTC (rev 1369) @@ -131,7 +131,8 @@ sweep-test mic-test record-base record-len la1+ " dma-free" $call-parent - close false + close + false ;
\ LICENSE_BEGIN
Modified: dev/hdaudio/core.fth =================================================================== --- dev/hdaudio/core.fth 2009-09-18 01:15:46 UTC (rev 1368) +++ dev/hdaudio/core.fth 2009-09-18 01:19:07 UTC (rev 1369) @@ -424,6 +424,8 @@
\ \ Playback
+false value playing? + : upsampling? ( -- ? ) scale-factor 1 <> ;
: open-out ( -- ) @@ -455,23 +457,31 @@ ;
: write ( adr len -- actual ) - 4 to sd# audio-out install-playback-alarm + 4 to sd# audio-out install-playback-alarm true to playing? ;
\ Alarm handle to stop the stream when the content has been played. : playback-completed-alarm ( -- ) - sd# ( sd# ) - 4 to sd# ( sd# ) - stream-done? if write-done then ( sd# ) - to sd# ( ) + sd# ( sd# ) + 4 to sd# ( sd# ) + stream-done? if write-done false to playing? then ( sd# ) + to sd# ( ) ;
' playback-completed-alarm is playback-alarm
-: wait-sound ( -- ) ; \ sound stops with asynchronous alarm handler +: wait-sound ( -- ) begin playing? 0= until ;
-: set-volume ( dB -- ) dac to node dB>step# output-gain ; +false value left-mute? +false value right-mute?
+: set-volume ( dB -- ) + dac to node + dB>step# + dup left-mute? if h# 80 or then h# 3a000 or cmd \ left gain + right-mute? if h# 80 or then h# 39000 or cmd \ right gain +; + \ \ Recording
0 value recbuf
Modified: dev/hdaudio/hdaudio.bth =================================================================== --- dev/hdaudio/hdaudio.bth 2009-09-18 01:15:46 UTC (rev 1368) +++ dev/hdaudio/hdaudio.bth 2009-09-18 01:19:07 UTC (rev 1369) @@ -14,6 +14,7 @@ fload ${BP}/dev/hdaudio/extra.fth fload ${BP}/forth/lib/isin.fth fload ${BP}/dev/geode/ac97/selftest.fth +fload ${BP}/dev/hdaudio/test.fth end0
end-tokenizing
Added: dev/hdaudio/test.fth =================================================================== --- dev/hdaudio/test.fth (rev 0) +++ dev/hdaudio/test.fth 2009-09-18 01:19:07 UTC (rev 1369) @@ -0,0 +1,88 @@ +purpose: Manufacturing testing +\ See license at end of file + +: alloc-buffer ( -- ) + record-len la1+ " dma-alloc" $call-parent to record-base +; +: dealloc-buffer ( -- ) + record-base record-len la1+ " dma-free" $call-parent +; + +: jingle ( -- ) " play-wav rom:splash" evaluate wait-sound ; + +: speaker-test ( -- ) + ." Playing jingle on the left speaker.. " + true to right-mute? + jingle cr + false to right-mute? + true to left-mute? + ." Playing jingle on the right speaker.. " + jingle cr + false to left-mute? +; + +: headphones-test ( -- ) + h# 19 to node + pin-sense? 0= if + ." Connect headphones to continue.. " + begin pin-sense? until cr + then + ." Press a key to play sound.. " key drop cr + h# 1f to node power-off \ turn off speaker + jingle + h# 1f to node power-on \ turn speaker back on +; + +: builtin-mic-test ( -- ) + ." Press a key to test recording / playback on the built-in microphone.. " + key drop cr + mic-test +; + +: external-mic-test ( -- ) + h# 1a to node + pin-sense? 0= if + ." Connect microphone to continue.. " + begin pin-sense? until cr + then + ." Press a key to test recording / playback on the external microphone.. " + key drop cr + mic-test +; + +: interactive-test ( -- error? ) + alloc-buffer + speaker-test + headphones-test + builtin-mic-test + external-mic-test + dealloc-buffer + " confirm-selftest?" eval +; +: selftest ( -- ) + diagnostic-mode? if interactive-test else selftest then +; + +\ LICENSE_BEGIN +\ Copyright (c) 2009 Luke Gorrie +\ +\ 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
Modified: dev/libertas.fth =================================================================== --- dev/libertas.fth 2009-09-18 01:15:46 UTC (rev 1368) +++ dev/libertas.fth 2009-09-18 01:19:07 UTC (rev 1369) @@ -1696,7 +1696,16 @@ ." Failed to scan" true cr else ( adr len ) \ drop .scan false - drop .ssids false + diagnostic-mode? if ( adr len ) + drop 2+ c@ if ( ) + false + else + ." ERROR: No access points seen" cr + true + then + else ( adr len ) + drop .ssids false + then then
close
Added: dev/olpc/confirm.fth =================================================================== --- dev/olpc/confirm.fth (rev 0) +++ dev/olpc/confirm.fth 2009-09-18 01:19:07 UTC (rev 1369) @@ -0,0 +1,18 @@ +purpose: Operator confirmation of selftest results + +: confirm-selftest? ( -- error? ) + diagnostic-mode? if + ." Did the test pass (n for FAIL) ? " + key dup emit cr upc [char] N = + else + false + then +; + +: has-direct-child? ( name@unit$ -- found? ) + also current @ >r ( name@unit$ r: current ) + [char] @ left-parse-string ( unit$ name$ r: current ) + ['] (find-node) catch ( unit$ name$ found? r: current ) + >r 4drop r> 0<> ( found? r: current ) + r> set-current previous ( found? ) +;
Modified: dev/olpc/dcon/viadcon.fth =================================================================== --- dev/olpc/dcon/viadcon.fth 2009-09-18 01:15:46 UTC (rev 1368) +++ dev/olpc/dcon/viadcon.fth 2009-09-18 01:19:07 UTC (rev 1369) @@ -110,6 +110,7 @@ ['] dcon! catch if 2drop smb-stop 1 ms smb-off 1 ms smb-on then ;
+: mode@ ( -- mode ) 1 dcon@ ; : mode! ( mode -- ) 1 dcon! ; : hres! ( hres -- ) 2 dcon! ; \ def: h# 458 d# 1200 : htotal! ( htotal -- ) 3 dcon! ; \ def: h# 4e8 d# 1256 @@ -124,6 +125,9 @@ : brighter ( -- ) bright@ 1+ h# f min bright! ; : dimmer ( -- ) bright@ 1- 0 max bright! ;
+: backlight-off ( -- ) mode@ 8 invert and mode! ; +: backlight-on ( -- ) mode@ 8 or mode! ; + \ Color swizzle, AA, no passthrough, backlight : set-color ( color? -- ) dup to color?
Modified: dev/olpc/kb3700/battery.fth =================================================================== --- dev/olpc/kb3700/battery.fth 2009-09-18 01:15:46 UTC (rev 1368) +++ dev/olpc/kb3700/battery.fth 2009-09-18 01:19:07 UTC (rev 1369) @@ -595,10 +595,96 @@ new-device " battery" device-name 0 0 reg \ Needed so test-all will run the selftest -: selftest ( -- error? ) - .bat + +\ Test that the battery is inserted and not broken. +: test-battery ( -- error? ) + bat-status@ h# 01 and 0= if + ." Insert battery to continue.. " + begin d# 100 ms bat-status@ h# 01 and until + cr + then + ." Testing battery status.. " + bat-status@ h# 04 and if + ." error: battery broken" cr + true + else + ." ok: " cr .bat cr + false + then +; + +: wait-no-ac ( -- error? ) + ." Disconnect AC power to continue.. " + d# 200 0 do + d# 100 ms + bat-status@ h# 10 and 0= if + false unloop cr exit + then + loop + cr + ." ERROR: AC not disconnected" cr + true +; + +\ Test that we can run without AC power. +: test-discharging ( -- error? ) + bat-status@ h# 10 and 0<> if + wait-no-ac if true exit then + then + ." Test running from battery.. " + d# 2000 ms + bat-status@ h# 40 and if + ." ok: battery discharging" cr + false + else + ." ERROR: battery not discharging" cr + true + then +; + +: wait-ac ( -- error? ) + ." Connect AC power to continue.. " + d# 200 0 do + d# 100 ms + bat-status@ h# 10 and if + false unloop cr exit + then + loop + cr + ." ERROR: AC not connected" cr + true +; + +: test-charging ( -- error? ) + bat-status@ h# 10 and 0= if + wait-ac if true exit then + then + ." Test running from AC.. " + d# 2000 ms + bat-status@ h# 40 and 0= if + ." ok: battery is not discharging" cr + false + else + ." ERROR: battery is discharging" cr + true + then +; + +: interactive-test ( -- error? ) + test-battery if true exit then + test-discharging if true exit then + test-charging if true exit then false ; + +: selftest ( -- error? ) + diagnostic-mode? if + interactive-test + else + .bat false + then +; + finish-device device-end
Modified: dev/olpc/keyboard/selftest.fth =================================================================== --- dev/olpc/keyboard/selftest.fth 2009-09-18 01:15:46 UTC (rev 1368) +++ dev/olpc/keyboard/selftest.fth 2009-09-18 01:19:07 UTC (rev 1369) @@ -429,7 +429,7 @@ screen-ih iselect erase-screen iunselect page close - false + confirm-selftest? ; warning !
Modified: dev/olpc/touchpad/touchpad.fth =================================================================== --- dev/olpc/touchpad/touchpad.fth 2009-09-18 01:15:46 UTC (rev 1368) +++ dev/olpc/touchpad/touchpad.fth 2009-09-18 01:19:07 UTC (rev 1369) @@ -466,7 +466,7 @@ close cursor-on page - 0 + confirm-selftest? ;
Modified: dev/olpc/viacamera/camera.fth =================================================================== --- dev/olpc/viacamera/camera.fth 2009-09-18 01:15:46 UTC (rev 1368) +++ dev/olpc/viacamera/camera.fth 2009-09-18 01:19:07 UTC (rev 1369) @@ -505,12 +505,17 @@ : unmirrored ( -- ) h# 1e ov@ h# 20 invert and h# 1e ov! ;
: selftest ( -- error? ) + serial-enabled? if + ." The serial port is in use so the camera cannot be used" cr + true exit + then camera-open 0= if true exit then d# 300 ms unmirrored shoot-still ?dup if camera-close exit then ( error? ) d# 1,000 ms mirrored shoot-movie full-brightness ( error? ) camera-close ( error? ) + ?dup 0= if confirm-selftest? then ( error? ) ;
: dump-regs ( run# -- )
openfirmware@openfirmware.info