Author: quozl Date: Sat Aug 18 07:25:14 2012 New Revision: 3196 URL: http://tracker.coreboot.org/trac/openfirmware/changeset/3196
Log: OLPC CL4 - Neonode, add display of MSP430 firmware version, fix display of low signal test results, add a minimum field strength value for customisation, read boot complete message before already-ready open, identify short or open components by silkscreen layer identifier.
Modified: cpu/arm/olpc/nn-touchscreen.fth
Modified: cpu/arm/olpc/nn-touchscreen.fth ============================================================================== --- cpu/arm/olpc/nn-touchscreen.fth Fri Aug 17 19:29:15 2012 (r3195) +++ cpu/arm/olpc/nn-touchscreen.fth Sat Aug 18 07:25:14 2012 (r3196) @@ -53,7 +53,7 @@ 2drop ( ) ;
-: read-boot-complete ( -- ) h# 07 d# 20 anticipate ; +: read-boot-complete ( -- ) h# 07 d# 0 anticipate ;
: initialise ( -- ) h# 01 h# 01 h# ee 3 twsi-out h# 01 d# 20 anticipate ;
@@ -86,8 +86,8 @@ no-data? if reset no-data? if pbuf /pbuf free-mem false exit then - read-boot-complete then + read-boot-complete ['] configure catch if pbuf /pbuf free-mem false exit then true ; @@ -111,43 +111,218 @@ ;
-0 value faults -: fault faults 1+ to faults ; +: (.version) ( addr -- ) + dup c@ over 1+ c@ bwjoin ( addr version ) + (.) type +; + +: .version ( addr -- ) + pbuf 2+ c@ h# 1e <> abort" bad response" + ." Neonode zForce Touch Driver firmware version " + pbuf 3 + 3 0 do ( addr ) + (.version) 2+ + [char] . emit + loop ( addr ) + (.version) ( ) +; + +: test-version ( -- ) + h# 1e h# 01 h# ee 3 twsi-out + h# 1e d# 30 anticipate
-: .bits ( addr low high -- addr ) - ." ( " swap do ( addr ) - i over bittest if - i .d fault - then - loop ." )" cr ( addr ) + .version + cr ;
+ +0 value faults +: fault faults 1+ to faults ; + : 4sp ." " ;
: 8sp ." " ;
+[ifdef] nn-components +\ optional decoding of component identifiers + +\ bit descriptions +\ shorts have been verified +\ a trailing ? means this combination is untested +string-array x-os + + ," PD13 open?" \ 01 00 00 00 00 00 00 00 + ," PD14 open?" \ 02 00 00 00 00 00 00 00 + ," PD15 open?" \ 04 00 00 00 00 00 00 00 + ," PD16 open?" \ 08 00 00 00 00 00 00 00 + ," PD17 open?" \ 10 00 00 00 00 00 00 00 + ," PD18 open?" \ 20 00 00 00 00 00 00 00 + ," PD19 open?" \ 40 00 00 00 00 00 00 00 + ," PD20 open?" \ 80 00 00 00 00 00 00 00 + + ," PD21 open?" \ 00 01 00 00 00 00 00 00 + ," PD22 open?" \ 00 02 00 00 00 00 00 00 + ," PD23 open?" \ 00 04 00 00 00 00 00 00 + ," PD24 open?" \ 00 08 00 00 00 00 00 00 + ," PD25 open?" \ 00 10 00 00 00 00 00 00 + ," PD26 open?" \ 00 20 00 00 00 00 00 00 + ," PD27 open?" \ 00 40 00 00 00 00 00 00 + ," PD28 open?" \ 00 80 00 00 00 00 00 00 + + ," PD13 short" \ 00 00 01 00 00 00 00 00 + ," PD14 short" \ 00 00 02 00 00 00 00 00 + ," PD15 short" \ 00 00 04 00 00 00 00 00 + ," PD16 short" \ 00 00 08 00 00 00 00 00 + ," PD17 short" \ 00 00 10 00 00 00 00 00 + ," PD18 short" \ 00 00 20 00 00 00 00 00 + ," PD19 short" \ 00 00 40 00 00 00 00 00 + ," PD20 short" \ 00 00 80 00 00 00 00 00 + + ," PD21 short" \ 00 00 00 01 00 00 00 00 + ," PD22 short" \ 00 00 00 02 00 00 00 00 + ," PD23 short" \ 00 00 00 04 00 00 00 00 + ," PD24 short" \ 00 00 00 08 00 00 00 00 + ," PD25 short" \ 00 00 00 10 00 00 00 00 + ," PD26 short" \ 00 00 00 20 00 00 00 00 + ," PD27 short" \ 00 00 00 40 00 00 00 00 + ," PD28 short" \ 00 00 00 80 00 00 00 00 + + ," IR12 short" \ 00 00 00 00 01 00 00 00 + ," IR13 short" \ 00 00 00 00 02 00 00 00 + ," IR14 short" \ 00 00 00 00 04 00 00 00 + ," IR15 short" \ 00 00 00 00 08 00 00 00 + ," IR16 short" \ 00 00 00 00 10 00 00 00 + ," IR17 short" \ 00 00 00 00 20 00 00 00 + ," IR18 short" \ 00 00 00 00 40 00 00 00 + ," IR19 short" \ 00 00 00 00 80 00 00 00 + + ," IR20 short" \ 00 00 00 00 00 01 00 00 + ," IR21 short" \ 00 00 00 00 00 02 00 00 + ," IR22 short" \ 00 00 00 00 00 04 00 00 + ," IR23 short" \ 00 00 00 00 00 08 00 00 + ," IR24 short" \ 00 00 00 00 00 10 00 00 + ," IR25 short" \ 00 00 00 00 00 20 00 00 + ," IR26 short" \ 00 00 00 00 00 40 00 00 + ," reserved?" \ 00 00 00 00 00 80 00 00 + + ," IR12 open?" \ 00 00 00 00 00 00 01 00 + ," IR13 open?" \ 00 00 00 00 00 00 02 00 + ," IR14 open?" \ 00 00 00 00 00 00 04 00 + ," IR15 open?" \ 00 00 00 00 00 00 08 00 + ," IR16 open?" \ 00 00 00 00 00 00 10 00 + ," IR17 open?" \ 00 00 00 00 00 00 20 00 + ," IR18 open?" \ 00 00 00 00 00 00 40 00 + ," IR19 open?" \ 00 00 00 00 00 00 80 00 + + ," IR20 open?" \ 00 00 00 00 00 00 00 01 + ," IR21 open?" \ 00 00 00 00 00 00 00 02 + ," IR22 open?" \ 00 00 00 00 00 00 00 04 + ," IR23 open?" \ 00 00 00 00 00 00 00 08 + ," IR24 open?" \ 00 00 00 00 00 00 00 10 + ," IR25 open?" \ 00 00 00 00 00 00 00 20 + ," IR26 open?" \ 00 00 00 00 00 00 00 40 + ," reserved?" \ 00 00 00 00 00 00 00 80 + +end-string-array + +string-array y-os + + ," PD4 open?" \ 01 00 00 00 00 00 + ," PD3 open?" \ 02 00 00 00 00 00 + ," PD2 open?" \ 04 00 00 00 00 00 + ," PD1 open?" \ 08 00 00 00 00 00 + ," PD12 open?" \ 10 00 00 00 00 00 + ," PD11 open?" \ 20 00 00 00 00 00 + ," PD10 open?" \ 40 00 00 00 00 00 + ," PD9 open?" \ 80 00 00 00 00 00 + + ," PD8 open?" \ 00 01 00 00 00 00 + ," PD7 open?" \ 00 02 00 00 00 00 + ," PD6 open?" \ 00 04 00 00 00 00 + ," PD5 open?" \ 00 08 00 00 00 00 + ," PD12 short" \ 00 10 00 00 00 00 + ," PD11 short" \ 00 20 00 00 00 00 + ," PD10 short" \ 00 40 00 00 00 00 + ," PD9 short" \ 00 80 00 00 00 00 + + ," PD8 short" \ 00 00 01 00 00 00 + ," PD7 short" \ 00 00 02 00 00 00 + ," PD6 short" \ 00 00 04 00 00 00 + ," PD5 short" \ 00 00 08 00 00 00 + ," PD4 short" \ 00 00 10 00 00 00 + ," PD3 short" \ 00 00 20 00 00 00 + ," PD2 short" \ 00 00 40 00 00 00 + ," PD1 short" \ 00 00 80 00 00 00 + + ," IR11 short" \ 00 00 00 01 00 00 + ," IR10 short" \ 00 00 00 02 00 00 + ," IR9 short" \ 00 00 00 04 00 00 + ," IR8 short" \ 00 00 00 08 00 00 + ," IR7 short" \ 00 00 00 10 00 00 + ," IR6 short" \ 00 00 00 20 00 00 + ," IR5 short" \ 00 00 00 40 00 00 + ," IR4 short" \ 00 00 00 80 00 00 + + ," IR3 short" \ 00 00 00 00 01 00 + ," IR2 short" \ 00 00 00 00 02 00 + ," IR1 short" \ 00 00 00 00 04 00 + ," reserved?" \ 00 00 00 00 08 00 + ," reserved?" \ 00 00 00 00 10 00 + ," IR11 open?" \ 00 00 00 00 20 00 + ," IR10 open?" \ 00 00 00 00 40 00 + ," IR9 open?" \ 00 00 00 00 80 00 + + ," IR8 open?" \ 00 00 00 00 00 01 + ," IR7 open?" \ 00 00 00 00 00 02 + ," IR6 open?" \ 00 00 00 00 00 04 + ," IR5 open?" \ 00 00 00 00 00 08 + ," IR4 open?" \ 00 00 00 00 00 10 + ," IR3 open?" \ 00 00 00 00 00 20 + ," IR2 open?" \ 00 00 00 00 00 40 + ," IR1 open?" \ 00 00 00 00 00 80 + +end-string-array + +defer our-os +' noop is our-os +[then] + +d# 64 constant /x-os +d# 48 constant /y-os + : test-os-axis ( axis -- ) h# 21 h# 02 h# ee 4 twsi-out h# 21 d# 30 anticipate pbuf 2+ c@ h# 21 <> abort" bad response"
- pbuf 3 + c@ if h# 0a else h# 0e then >r ( r:nleds ) - pbuf 5 + ( r:nleds array ) + pbuf d# 5 + ( addr )
- \ bit array layout: | open_pd | short_pd | short_led | open_led | - \ subarray widths: | npds bits | npds bits | nleds bits | nleds bits | - \ npds = nleds+1 - - \ FIXME: express failed devices in terms of IR PCB component names. - \ 0 npds - 8sp ." open_pd=" 0 r@ 1+ .bits - \ npds npds*2 - 8sp ." short_pd=" r@ 1+ r@ 1+ 2* .bits - \ npds*2 npds*2+nleds - 8sp ." short_led=" r@ 1+ 2* dup r@ + .bits - \ npds*2+nleds npds*2+nleds*2 - 8sp ." open_led=" r@ 1+ 2* r@ + dup r@ + .bits - r> drop drop ( ) + pbuf 3 + c@ if + pbuf 4 + c@ h# 16 <> abort" bad signals y" + [ifdef] nn-components + ['] y-os to our-os + [then] + /y-os ( addr bits# ) + else + pbuf 4 + c@ h# 1e <> abort" bad signals x" + [ifdef] nn-components + ['] x-os to our-os + [then] + /x-os ( addr bits# ) + then + + 0 do ( addr ) + dup c@ ( addr byte ) + i 8 mod ( addr byte bit# ) + rshift 1 and if ( addr ) + 8sp + [ifdef] nn-components + i our-os count type + [then] + ." ( bit " i .d ." )" cr + fault + then ( addr ) + i 8 mod 7 = if 1+ then ( addr' ) + loop drop ( ) cr ;
@@ -157,6 +332,18 @@ 4sp ." Y Axis" cr 1 test-os-axis ;
+[ifdef] nn-components +d# 11 constant x-ir-0 \ first X axis IR component identifier +d# 12 constant x-pd-0 \ first X axis PD component identifier +d# -1 constant x-up \ direction of numbering + +d# 12 constant y-ir-0 +d# 13 constant y-pd-0 +d# 1 constant y-up +[then] + +d# 1 value fss-min + : test-fss-axis ( axis -- ) d# 64 swap h# 0f h# 03 h# ee 5 twsi-out h# 0f d# 20 anticipate @@ -165,14 +352,18 @@ push-decimal pbuf 4 + c@ 0 do ( ) pbuf 5 + i + c@ - dup 0= if fault then + dup fss-min < if fault then 4 .r space i d# 10 mod d# 9 = if cr 8sp then loop cr pop-base +[ifdef] nn-components + \ FIXME: express failed signals in terms of IR PCB component names. + \ Y axis, IR11 PD12, IR11 PD11, IR10 PD11 ... IR1 PD1 + \ X axis, IR12 PD13, IR12 PD14, IR13 PD14 ... IR26 PD28 +[then] \ FIXME: using a light guide, characterise a low signal level, \ detect, and fail self test - \ FIXME: express failed signals in terms of IR PCB component names. ;
: test-fss @@ -187,10 +378,19 @@ pbuf 2+ c@ h# 0d <> abort" bad response"
8sp - pbuf 4 + c@ >r ( r:nsigs ) - pbuf 5 + ( r:nsigs array ) - 0 r@ 1+ .bits ( r:nsigs array ) - r> drop drop ( ) + pbuf 5 + ( addr ) + pbuf 4 + c@ ( addr #bits ) + ." ( " 0 do ( addr ) + dup c@ ( addr byte ) + i 8 mod ( addr byte bit# ) + rshift 1 and if ( addr ) + i .d + fault + then + i 8 mod ( addr rem ) + 7 = if 1+ then ( addr' ) + loop drop ( ) + ." )" cr cr \ FIXME: express low signals in terms of IR PCB component names. ; @@ -213,6 +413,7 @@
diagnostic-mode? if 0 to faults + test-version test-os test-fss test-ls
openfirmware@openfirmware.info