[openfirmware] [commit] r1745 - cpu/x86/build cpu/x86/pc/olpc/via ofw/fcode

repository service svn at openfirmware.info
Tue Feb 16 08:41:37 CET 2010


Author: wmb
Date: Tue Feb 16 08:41:37 2010
New Revision: 1745
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/1745

Log:
OLPC XO-1.5 - Graphical instructions for manufacturing tests.

Modified:
   cpu/x86/build/builder.dic
   cpu/x86/pc/olpc/via/drawboardtop.fth
   cpu/x86/pc/olpc/via/factory.fth
   cpu/x86/pc/olpc/via/smt.fth
   ofw/fcode/applcode.fth
   ofw/fcode/extcodes.fth
   ofw/fcode/loadfcod.fth
   ofw/fcode/sysprims.fth

Modified: cpu/x86/build/builder.dic
==============================================================================
Binary file (source and/or target). No diff available.

Modified: cpu/x86/pc/olpc/via/drawboardtop.fth
==============================================================================
--- cpu/x86/pc/olpc/via/drawboardtop.fth	Sat Feb 13 20:27:16 2010	(r1744)
+++ cpu/x86/pc/olpc/via/drawboardtop.fth	Tue Feb 16 08:41:37 2010	(r1745)
@@ -1,3 +1,194 @@
+support-package: test-instructions
+
+decimal
+
+\ Common items
+
+: headphones-logo
+   24 5 rmove  -6 0  -10 6  -10 13 rcurve
+   10 -13 rmove  6 0  10 6  10 13 rcurve
+   -16 4 rmove  -2 0  -3 -1  -3 -2 rcurve  0 -3  1 -3  3 -3 rcurve  0 5 rline   
+   12 -5 rmove  2 0  3 0  3 2  rcurve  0 3  -1 3  -3 3 rcurve  0 -5 rline
+;
+
+: led-symbol  ( x y -- )
+   moveto  5 5 rline  5 -5 rline  -5 -5 rline  -5 5 rline
+;
+: usb-logo
+   14 11  rmove
+   1 1  1 3  0 4  rcurve
+   -1 1  -2 1  -3 0  rcurve
+   -1 -1  -1 -3  0 -4  rcurve
+   1 -1  2 -1  3 0  rcurve
+
+   10 -4  rmove
+   1 -1  1 -2  0 -2  rcurve
+   0 -1  -1 -1  -1 0  rcurve
+   0 0  0 1  0 2  rcurve
+   0 0  1 0  1 0  rcurve
+
+   -12 6  rmove  18 0  rline  
+   5 0  rmove   -5 -2  rline  0 4  rline  5 -2  rline  
+   -7 6  rmove   2 0  rline  0 3  rline  -2 0  rline  0 -3  rline  
+   -11 -6  rmove
+   1 -2  2 -5  3 -6  rcurve
+   1 -2  2 -1  3 -1  rcurve
+
+   -2 7  rmove
+   2 2  2 5  4 7  rcurve
+   1 1  3 0  5 0  rcurve
+;
+: mic-logo
+   -4 0  -6 -3  -6 -5  rcurve
+   6 5  rmove   3 0  6 -3  6 -5  rcurve
+   -4 -8  rmove
+   0  8  rline  0  1  -1  2  -2  2  rcurve  -1 0  -2 -1  -2 -2  rcurve
+   0 -8  rline  0 -1   1 -2   2 -2  rcurve   1 0   2  1   2  2  rcurve
+   -2 13  rmove  0 3  rline   3 0  rmove  -7 0  rline  
+;
+
+\ Board bottom items
+
+: rantenna  ( -- )
+   -5 -5 rmove  10 10 rbox  5 5 rmove  rpoint  5 rcircle
+;
+: wlan-card
+   362 6  75 74 boxat
+   10  9 rmove  rantenna
+   55  0 rmove  rantenna
+;
+
+: board-outline 
+     4  36 moveto
+    58  36 lineto   58   0 lineto  355   0 lineto  355  99 lineto
+   445  99 lineto  445   0 lineto  526   0 lineto  526  36 lineto
+   580  36 lineto  580 360 lineto  436 360 lineto  436 324 lineto
+   148 324 lineto  148 360 lineto    4 360 lineto    4  36 lineto 
+;
+
+: mic-conn
+  535 52  45 28 boxat
+  24 20 rmove  mic-logo
+  580 58   8 16 boxat
+;
+: headphone-conn
+  535 90  45 28 boxat
+  headphones-logo
+  580 96   8 16 boxat
+;
+: ac-conn  553 306  36 27 boxat  ;
+: ext-sd-slot  13 270  81 90 boxat ;
+: kbd-conn   175 279  13 27 boxat  ;
+
+: ext-sd-card
+   20 283 moveto 20 369 lineto 87 369 lineto 87 294 lineto 76 283 lineto 20 283 lineto 
+;
+
+: usb0-conn
+   537 126  45 27 boxat
+   usb-logo
+;
+: usb1-conn
+   0 54  45 27 boxat
+   usb-logo   
+;
+: usb2-conn
+   0 99  45 45 boxat
+   0 9 rmove  usb-logo
+;
+: battery-conn
+   444 306  27 27 boxat
+   427 279  18 18 boxat
+;   
+
+: led0  105 349 led-symbol  ;
+: led1  131 349 led-symbol  ;
+: led2  446 349 led-symbol  ;
+: led3  473 349 led-symbol  ;
+: cmos-battery-conn
+   304  85  12 18 boxat
+   306  81   8  4 boxat
+   306 103   8  4 boxat
+;
+
+: cmos-battery
+   262 60  22 circleat
+   \ Wires
+   243 71 moveto
+     238  75   228  81   229  86 curveto
+     229  90   242  99   249 100 curveto
+     255 100   262  89   269  89 curveto
+     275  89   280 100   286 100 curveto
+     292 100   297  93   303  90 curveto
+   247 76 moveto
+     241  81   231  89   229  93 curveto
+     226  96   230  99   234  99 curveto
+     237  99   244  90   250  91 curveto
+     255  91   261 101   268 101 curveto
+     274 100   280  90   286  90 curveto
+     292  90   298  96   304  99 curveto
+;
+
+: rspkr-conn
+   22 154  18 16 boxat
+   18 159  4 8 boxat
+   40 159  4 8 boxat
+;
+: lspkr-conn
+   544 171  18 16 boxat
+   540 175  4 8 boxat
+   562 175  4 8 boxat
+;
+
+: wlan-conn  350 81  100 28 boxat  ;
+
+: serial-conn
+   72 51  18 27 boxat
+   76 47  8 4 boxat
+   76 78  8 4 boxat
+;
+
+: int-sd-slot  411 159  51 45 boxat  ;
+
+: int-sd-card
+   404 200 moveto
+   404 164 lineto  458 164 lineto  458 191 lineto  440 191 lineto  431 200 lineto
+   427 200 lineto  427 195 lineto  423 195 lineto  418 199 lineto  404 200 lineto 
+;
+
+: basic-layout  ( -- )
+   clear-drawing
+   d# 10 d# 20 offsetat
+   double-drawing
+;
+: draw-board  ( -- )
+   basic-layout
+   board-outline
+   mic-conn
+   headphone-conn
+   ac-conn
+   ext-sd-slot
+   kbd-conn
+   usb0-conn
+   usb1-conn
+   usb2-conn
+   battery-conn
+   led0  led1  led2  led3
+   cmos-battery-conn
+   cmos-battery
+   rspkr-conn
+   lspkr-conn
+   wlan-conn
+   serial-conn
+   int-sd-slot
+
+   wlan-card
+   int-sd-card
+   ext-sd-card
+;
+
+\ Board top items
+
 : button-symbol  ( x y -- )
    2dup  18 18 boxat
    swap 9 +  swap 9 +  6 circleat
@@ -9,12 +200,12 @@
    234  99 lineto  144  99 lineto  144   0 lineto   63   0 lineto
     63  36 lineto    9  36 lineto    9 360 lineto  153 360 lineto 
 ;
-: hph
+: headphones-top
    2 95   7 18  boxat
    9 91  45 28  boxat
    headphones-logo
 ;
-: mic
+: mic-top
    9 54  45 28  boxat
    24 20 rmove  mic-logo
    2 59   7 18  boxat
@@ -74,10 +265,11 @@
 : ext-sd-slot  497 360  81 9  boxat  ;
 
 : draw-top  ( -- )
-   clear-drawing
+   basic-layout
+
    top-outline
-   hph
-   mic
+   headphones-top
+   mic-top
    acin
    int-mic-conn
    usb0 usb1 usb2
@@ -105,3 +297,184 @@
    wlan-card-top
    ext-sd-slot
 ;
+
+: usb-key  ( -- )
+   95 155 moveto  130 165 lineto 130 155 lineto  95 145 lineto 95 155 lineto
+   130 155 moveto 150 140 lineto 150 150 lineto  130 165 lineto
+   150 140 moveto 115 130 lineto 95 145 lineto
+   146 153 moveto 155 155 lineto 155 135 lineto 110 122 lineto 110 133 lineto
+   110 122 moveto 110 122  171 67  197 54 curveto  229 38 295 42 155 135 curveto
+   155 156 moveto 218 111  229 100 241 81 curveto  248 65 239 51 239 51 curveto
+;
+
+: scanner  ( -- )
+   195 98 moveto
+   195 111  174 121  149 121 curveto
+   123 121  103 111  102  98 curveto
+   103  85  123  75  149  75 curveto
+   174  75  195  85  195  98 curveto
+
+   113 83 moveto
+   193 40 228 48 239 61 curveto
+   261 90 171 118 171 120 curveto
+
+   235 85 moveto
+   281 177 310 177 267 201 curveto
+   251 209 227 200 235 189 curveto
+   243 177 249 179 248 172 curveto
+   239 121 196 109 200 109 curveto
+;
+
+: usb-ethernet
+   130 212 moveto
+   141 218 145 220 145 205 curveto 145 190 145 190 125 180 curveto
+   105 170 105 171 105 185 curveto 105 190 105 185 105 190 curveto
+
+   105 190 moveto
+   106 190 105 192 105 185 curveto 105 170 105 170 135 155 curveto 165 140 165 140 185 150 curveto
+   205 160 205 160 205 175 curveto 205 190 205 190 175 205 curveto 145 220 146 221 130 212 curveto
+
+   125 190 moveto 135 195 lineto 115 205 lineto 95 195 lineto 115 185 lineto 120 188 lineto
+   105 215 moveto 115 220 lineto 115 205 lineto 95 195 lineto 95 206 lineto
+   115 220 moveto 135 210 lineto 135 195 lineto 115 205 lineto 115 220 lineto
+   102 202 moveto  105 201 109 202 110 205 curveto  111 208 111 211 109 213 curveto
+   109 213 moveto  78 232 38 242 38 242 curveto
+   103 202 moveto  76 219 38 230 38 230 curveto
+   130 188 moveto  121 193 lineto  115 190 lineto  125 185 lineto  130 188 lineto
+   130 188 moveto  130 189 130 193 130 193 curveto
+   115 185 moveto  120 188 lineto
+   135 195 moveto  126 191 lineto
+
+   321 96 moveto 321 106 lineto 322 106 308 124 287 118 curveto
+   306 108 moveto 313 105 321 96 321 96 curveto 303 89 lineto 303 89 296 92 289 98 curveto 275 112 291 117 306 108 curveto
+   327 90 moveto  327 96 lineto 321 101 lineto
+   307 90 moveto 315 85 lineto 327 90 lineto 319 95 lineto
+   283 111 moveto 284 114 287 112 288 113 curveto 289 114 289 116 288 117 curveto
+   284 111 moveto 284 110 lineto
+
+   287 111 moveto  250 134  198 157  198 157 curveto
+   288 117 moveto  238 147  203 161  203 161 curveto
+;
+
+
+0 value blink-time
+-1 value blink-state
+0 value blink-color
+h# ff0000 constant red-888
+h# 00ff00 constant green-888
+h# 0000ff constant blue-888
+h# 000000 constant black-888
+h# ffffff constant white-888
+h# ff00ff constant magenta-888
+magenta-888 to blink-color
+
+: set-default-color  ( -- )  black-888 set-fg  ;
+
+defer selected-object  ' noop to selected-object
+
+: idle  ( -- )
+   blink-state -1 =  if  exit  then
+   1 ms
+   get-msecs blink-time -  0>=  if
+      blink-state 1 xor dup to blink-state  ( state )
+      if  blink-color set-fg  else  white-888 set-fg  then
+      selected-object
+      get-msecs d# 400 +  to blink-time
+   then
+;
+
+: highlight  ( xt color -- )
+   to blink-color
+   to selected-object
+   get-msecs to blink-time
+   0 to blink-state
+   idle
+;
+: message-off  ( -- )  d# 2  d# 27  at-xy  kill-line  ;
+: message  ( adr len -- )  cursor-off  message-off  red-letters  type  black-letters  ;
+
+: performed  ( -- )
+   -1 to blink-state
+   message-off
+   set-default-color
+   selected-object
+   cr
+;
+
+: connect-scanner  ( -- )
+   basic-layout
+   " Connect USB barcode scanner to continue.." message
+   ['] scanner green-888 highlight
+;
+
+: connect-usb-key  ( -- )
+   basic-layout
+   " Connect USB stick to continue.." message
+   ['] usb-key green-888 highlight
+;
+
+: connect-usb-ethernet  ( -- )
+   basic-layout
+   " Connect USB Ethernet to continue.." message
+   ['] usb-ethernet green-888 highlight
+;
+
+: connect-headphones  ( -- )
+   draw-top
+   " Connect headphones to continue.." message
+   ['] headphones-top h# 00e000  highlight  \ Green like headphone jack
+;
+: disconnect-headphones  ( -- )
+   draw-top
+   " Disconnect headphones to continue.." message
+   ['] headphones-top red-888 highlight
+;
+: connect-microphone  ( -- )
+   draw-top
+   " Connect microphone to continue.." message
+   ['] mic-top h# ff80c0 highlight \ Close enough to the pink of the mic jack
+;
+: disconnect-microphone  ( -- )
+   draw-top
+   " Disconnect microphone to continue.." message
+   ['] mic-top red-888 highlight
+;
+: mic+phones-top  ( -- )  mic-top headphones-top  ;
+: connect-loopback  ( -- )
+   draw-top
+   " Connect loopback cable to continue.." message
+   ['] mic+phones-top green-888 highlight
+;
+: disconnect-loopback  ( -- )
+   draw-top
+   " Disconnect loopback cable to continue.." message
+   ['] mic+phones-top red-888 highlight
+;
+
+: connect-int-sd  ( -- )
+   draw-board
+   " Power off and connect internal SD card to continue.." message
+   ['] int-sd-card green-888 highlight
+;   
+
+: open  ( -- ok )  true  ;
+: close  ( -- )  ;
+
+end-package
+0 value instructions-ih
+
+: ($instructions)  ( name$ -- )
+   instructions-ih 0=  if
+      " "  " test-instructions" $open-package to instructions-ih
+   then
+   instructions-ih $call-method
+;
+' ($instructions) to $instructions
+
+: (instructions-idle)  ( -- )  " idle" $instructions  ;
+' (instructions-idle) to instructions-idle
+
+: (instructions-done)  ( -- )  " performed" $instructions  ;
+' (instructions-done) to instructions-done
+
+: diag-mode  ( -- )  true to diag-switch?  ;

Modified: cpu/x86/pc/olpc/via/factory.fth
==============================================================================
--- cpu/x86/pc/olpc/via/factory.fth	Sat Feb 13 20:27:16 2010	(r1744)
+++ cpu/x86/pc/olpc/via/factory.fth	Tue Feb 16 08:41:37 2010	(r1745)
@@ -105,8 +105,11 @@
 ;   
 : wait-scanner  ( -- )
    scanner?  0=  if
-      " Connect USB barcode scanner"  .instructions
-      begin  d# 1000 ms  silent-probe-usb  scanner?  until
+\      " Connect USB barcode scanner"  .instructions
+\      begin  d# 250 ms  silent-probe-usb  scanner?  until
+      " connect-scanner"  $instructions
+      begin  instructions-idle  d# 400 ms  silent-probe-usb  scanner?  until
+      instructions-performed
       ?usb-keyboard
    then
 ;
@@ -115,8 +118,9 @@
 ;
 : wait-lan  ( -- )
    wired-lan?  0=  if
-      " Connect USB Ethernet Adapter" .instructions
-      begin  d# 1000 ms  silent-probe-usb  wired-lan?  until
+      " connect-usb-ethernet" $instructions
+      begin  d# 400 ms  instructions-idle  silent-probe-usb  wired-lan?  until
+      instructions-performed
    then
 ;
 : usb-key?  ( -- flag )
@@ -124,8 +128,9 @@
 ;
 : wait-usb-key  ( -- )
    usb-key?  0=  if
-      " Connect USB memory stick" .instructions
-      begin  d# 1000 ms  silent-probe-usb  usb-key?  until
+      " connect-usb-key" $instructions
+      begin  d# 400 ms    instructions-idle  silent-probe-usb  usb-key?  until
+      instructions-performed
    then
 ;
 : stall  ( -- )  begin  halt  again  ;

Modified: cpu/x86/pc/olpc/via/smt.fth
==============================================================================
--- cpu/x86/pc/olpc/via/smt.fth	Sat Feb 13 20:27:16 2010	(r1744)
+++ cpu/x86/pc/olpc/via/smt.fth	Tue Feb 16 08:41:37 2010	(r1745)
@@ -271,8 +271,10 @@
 
 : require-int-sd  ( -- )
    " int:0" open-dev  ?dup  if  close-dev exit  then
-   " Power off and insert internal SD card" .problem
-   stall
+\   " Power off and insert internal SD card" .problem
+\   stall
+   " connect-int-sd" $instructions
+   begin  instructions-idle  again
 ;
 
 : wait-connections  ( -- )

Modified: ofw/fcode/applcode.fth
==============================================================================
--- ofw/fcode/applcode.fth	Sat Feb 13 20:27:16 2010	(r1744)
+++ ofw/fcode/applcode.fth	Tue Feb 16 08:41:37 2010	(r1745)
@@ -143,3 +143,7 @@
 [then]
 \ alias wflips wbflips
 \ alias lflips lwflips
+
+defer $instructions  ( name$ -- )  ' 2drop to $instructions
+defer instructions-done  ( -- )    ' noop to instructions-done
+defer instructions-idle  ( -- )    ' noop to instructions-idle

Modified: ofw/fcode/extcodes.fth
==============================================================================
--- ofw/fcode/extcodes.fth	Sat Feb 13 20:27:16 2010	(r1744)
+++ ofw/fcode/extcodes.fth	Tue Feb 16 08:41:37 2010	(r1745)
@@ -3,3 +3,12 @@
 hex
 vfw    070 2 byte-code: lock[		( -- )
 vfw    071 2 byte-code: ]unlock		( -- )
+
+vfw    072 2 byte-code: debug-me
+vfw    073 2 byte-code: new-instance      ( args-adr args-len -- )
+vfw    074 2 byte-code: destroy-instance  ( -- )
+vfw    075 2 byte-code: set-default-unit  ( -- )
+
+vfw    076 2 byte-code: $instructions     ( name$ -- )
+vfw    077 2 byte-code: instructions-done ( -- )
+vfw    078 2 byte-code: instructions-idle ( -- )

Modified: ofw/fcode/loadfcod.fth
==============================================================================
--- ofw/fcode/loadfcod.fth	Sat Feb 13 20:27:16 2010	(r1744)
+++ ofw/fcode/loadfcod.fth	Tue Feb 16 08:41:37 2010	(r1745)
@@ -72,6 +72,7 @@
 fload ${BP}/ofw/fcode/comptokt.fth
 fload ${BP}/ofw/fcode/primlist.fth		\ Codes for kernel primitives
 fload ${BP}/ofw/fcode/sysprims.fth		\ Codes for system primitives
+fload ${BP}/ofw/fcode/extcodes.fth		\ FirmWorks-specific primitives
 64\ fload ${BP}/ofw/fcode/sysprm64.fth	\ Codes for 64-bit system primitives
 fload ${BP}/ofw/fcode/debugfc.fth		\ FCode source directives
 fload ${BP}/ofw/fcode/loaddi.fth

Modified: ofw/fcode/sysprims.fth
==============================================================================
--- ofw/fcode/sysprims.fth	Sat Feb 13 20:27:16 2010	(r1744)
+++ ofw/fcode/sysprims.fth	Tue Feb 16 08:41:37 2010	(r1745)
@@ -369,9 +369,3 @@
 
 \ --- parsing argument strings
 v2    040 2 byte-code: left-parse-string ( adr len char -- adrR lenR adrL lenL )
-
-\ --- New FirmWorks stuff
-v3    041 2 byte-code: debug-me
-v3    042 2 byte-code: new-instance      ( args-adr args-len -- )
-v3    043 2 byte-code: destroy-instance  ( -- )
-v3    044 2 byte-code: set-default-unit  ( -- )



More information about the openfirmware mailing list