Author: wmb
Date: Tue Jun 7 22:41:07 2011
New Revision: 2252
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2252
Log:
OLPC XO-1.75 trac #10973 - Fixed RTC register scrambling.
Modified:
cpu/arm/olpc/1.75/rtc.fth
Modified: cpu/arm/olpc/1.75/rtc.fth
==============================================================================
--- cpu/arm/olpc/1.75/rtc.fth Tue Jun 7 09:39:17 2011 (r2251)
+++ cpu/arm/olpc/1.75/rtc.fth Tue Jun 7 22:41:07 2011 (r2252)
@@ -33,12 +33,12 @@
: bcd-time&date ( -- s m h d m y century )
set-address
[ifdef] cl2-a1
- 7 0 smb-read-n ( s m h dow d m y )
+ 9 0 smb-read-n ( s m h dow d m y control c )
[else]
- 0 1 7 twsi-get ( s m h dow d m y )
+ 0 1 9 twsi-get ( s m h dow d m y control c )
[then]
- 3 roll drop ( s m h dow d m y )
- d# 20
+ nip ( s m h dow d m y c )
+ 4 roll drop ( s m h d m y c )
;
: bcd! ( n offset -- ) swap >bcd swap rtc! ;
@@ -50,7 +50,7 @@
d# 100 * + \ Merge century with year
;
: set-time ( s m h d m y -- )
- d# 100 /mod h# 1a bcd! 9 bcd! 8 bcd! 7 bcd! 4 bcd! 2 bcd! 0 bcd!
+ d# 100 /mod h# 8 bcd! 6 bcd! 5 bcd! 4 bcd! 2 bcd! 1 bcd! 0 bcd!
;
: selftest ( -- flag )
Author: quozl
Date: Tue Jun 7 09:39:17 2011
New Revision: 2251
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2251
Log:
OLPC XO-1.75 A2 A3 - Remove delay on access to external SD now that
discharge switches are in place. " t( dir ext:\ )t " shows 562ms before
this patch, and 94ms after this patch. Even more time is saved when a
directory is accessed. Has no effect on internal SD. #10512.
Breaks A1 external SD for some cards, but we are no longer building for
A1 and a workaround can be used prior to access: " dev /sd d# 250 to
power-off-time "
Modified:
cpu/arm/olpc/1.75/sdhci.fth
Modified: cpu/arm/olpc/1.75/sdhci.fth
==============================================================================
--- cpu/arm/olpc/1.75/sdhci.fth Mon Jun 6 18:49:08 2011 (r2250)
+++ cpu/arm/olpc/1.75/sdhci.fth Tue Jun 7 09:39:17 2011 (r2251)
@@ -5,6 +5,7 @@
fload ${BP}/cpu/arm/olpc/1.75/sdregs.fth
fload ${BP}/dev/mmc/sdhci/sdhci.fth
+ d# 1 to power-off-time \ A2 and A3 have turn-off clamps
\ true to avoid-high-speed?
hex
Author: wmb
Date: Mon Jun 6 03:46:57 2011
New Revision: 2249
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2249
Log:
OLPC XO-1.75 - Now that the vector table is not in the available property - thus preventing memory test from zapping it - the code that looks for the available memory size must accept a memory node starting at 0x1000 instead of at 0.
Modified:
cpu/arm/linux.fth
Modified: cpu/arm/linux.fth
==============================================================================
--- cpu/arm/linux.fth Mon Jun 6 03:45:12 2011 (r2248)
+++ cpu/arm/linux.fth Mon Jun 6 03:46:57 2011 (r2249)
@@ -18,7 +18,7 @@
" available" rot get-package-property abort" No memory node available property" ( $ )
\ Find the memory piece that starts at 0
begin dup 8 >= while ( $ )
- decode-int 0= if ( $ ) \ Found the one we want
+ decode-int h# 1000 u<= if ( $ ) \ Found the one we want
decode-int ( $ limit )
nip nip exit
then ( $ )
Author: wmb
Date: Sun Jun 5 10:01:59 2011
New Revision: 2247
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2247
Log:
OLPC XO-1.75 trac #10919 - Accelerometer test - type "roller".
Added:
cpu/arm/olpc/1.75/roller.fth
Modified:
cpu/arm/olpc/1.75/fw.bth
Modified: cpu/arm/olpc/1.75/fw.bth
==============================================================================
--- cpu/arm/olpc/1.75/fw.bth Sat Jun 4 22:40:52 2011 (r2246)
+++ cpu/arm/olpc/1.75/fw.bth Sun Jun 5 10:01:59 2011 (r2247)
@@ -209,6 +209,7 @@
fload ${BP}/cpu/x86/pc/olpc/gridmap.fth \ Gridded display tools
fload ${BP}/cpu/x86/pc/olpc/via/copynand.fth
fload ${BP}/cpu/arm/olpc/1.75/exc7200-touchscreen.fth \ Touchscreen driver and diagnostic
+fload ${BP}/cpu/arm/olpc/1.75/roller.fth \ Accelerometer test
fload ${BP}/cpu/arm/olpc/1.75/pinch.fth \ Touchscreen gestures
: pinch " pinch" screen-ih $call-method ;
Added: cpu/arm/olpc/1.75/roller.fth
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ cpu/arm/olpc/1.75/roller.fth Sun Jun 5 10:01:59 2011 (r2247)
@@ -0,0 +1,276 @@
+\ See license at end of file
+purpose: Accelerometer test
+
+: 3! ( n1 n2 n3 adr -- ) tuck 2 na+ ! 2! ;
+: 3@ ( adr -- n1 n2 n3 ) dup 2@ rot 2 na+ @ ;
+3 actions
+action: >user 3@ ;
+action: >user 3! ;
+action: >user ;
+: 3value-cf create-cf use-actions ;
+: 3value ( n1 n2 n3 "name" -- ) header 3value-cf 3 /n* user#, 3! ;
+
+0 0 0 3value pos-b \ Ball position
+0 0 0 3value vel-b \ Ball velocity
+
+[ifdef] notdef
+0 0 0 3value acc-0 \ Accelerometer calibration
+[then]
+
+d# 8 value #fraction-bits
+: fraction* ( -- ) * #fraction-bits >>a ;
+: 1/2 ( -- n ) 1 #fraction-bits 1- lshift ;
+: >fraction ( n -- fraction ) #fraction-bits lshift ;
+: a/b>fraction ( num denom -- fraction ) swap #fraction-bits lshift swap / ;
+
+: xyz* ( x,y,z factor -- x',y',z' )
+ >r
+ rot r@ fraction*
+ rot r@ fraction*
+ rot r> fraction*
+;
+: xyz+ ( x1 y1 z1 x2 y2 z2 -- x3 y3 z3 )
+ 3 roll + >r ( x1 y1 x2 y2 r: z3 )
+ rot + >r ( x1 x2 r: z3 y3 )
+ + r> r> ( x3 y3 z3 )
+;
+: xyz- ( x1 y1 z1 x2 y2 z2 -- x3 y3 z3 )
+ 3 roll swap - >r ( x1 y1 x2 y2 r: z3 )
+ rot swap - >r ( x1 x2 r: z3 y3 )
+ - r> r> ( x3 y3 z3 )
+;
+
+: xyz>fraction ( x y z -- x' y' z' )
+ rot #fraction-bits lshift
+ rot #fraction-bits lshift
+ rot #fraction-bits lshift
+;
+: xyz>integer ( x y z -- x' y' z' )
+ 1/2 dup dup xyz+ \ Round up
+ rot #fraction-bits >>a
+ rot #fraction-bits >>a
+ rot #fraction-bits >>a
+;
+
+0 value accel-ih
+: get-acceleration ( -- x y z )
+ " acceleration@" accel-ih $call-method xyz>fraction
+;
+: init-accelerometer ( -- )
+ accel-ih if exit then
+ " /accelerometer" open-dev to accel-ih
+ accel-ih 0= abort" Can't open accelerometer"
+
+[ifdef] notdef
+ \ Calibrate the accelerometer by averaging 4 samples
+ get-acceleration ( x y z )
+ get-acceleration xyz+ ( x' y' z' )
+ get-acceleration xyz+ ( x' y' z' )
+ get-acceleration xyz+ ( x' y' z' )
+ 1 4 a/b>fraction xyz* to acc-0
+[then]
+;
+
+\ This is a damping factor for the velocity - essentially a frictional force
+
+d# 19 d# 20 a/b>fraction value damping
+
+d# 1 d# 10 a/b>fraction value acc-scale
+
+d# 20 constant ball-radius
+d# 40 constant ball-diameter
+
+d# 1200 ball-diameter - >fraction constant maxx
+d# 900 ball-diameter - >fraction constant maxy
+d# 400 >fraction constant maxz
+
+: 3swap ( x1 y1 z1 x2 y2 z2 -- x2 y2 z2 x1 y1 z1 ) 5 roll 5 roll 5 roll ;
+: 3over ( x1 y1 z1 x2 y2 z2 -- x2 y2 z2 x1 y1 z1 ) 5 pick 5 pick 5 pick ;
+
+[ifdef] notdef
+0 0 0 3value pos-b' \ New ball position
+0 0 0 3value vel-l \ Laptop velocity
+
+\ The original idea was to model a ball floating in a vat of fluid.
+\ Shaking the vat would make the ball move. That didn't work very well.
+: update-laptop ( -- )
+ get-acceleration acc-0 xyz- ( accl-x,y,z )
+ acc-scale xyz*
+
+ \ Compute new position of laptop based on acceleration and current
+ \ laptop velocity, and change the coordinate system origin to the
+ \ new position.
+ 3dup 1/2 xyz* vel-l xyz+ ( accl-x,y,z posl-x,y,z )
+ pos-b 3swap xyz- to pos-b' ( accl-x,y,z )
+
+ \ Compute new laptop velocity
+ vel-l damping xyz* xyz+ to vel-l ( )
+;
+
+\ This is a simple approximation for the magnitude of a 3-vector
+\ - largest component plus 1/3 the sum of the two smaller components.
+\ It works surprisingly well, especially since we use it to estimate
+\ drag, which is a complicated phenomenon for which the formula is
+\ only an approximation anyway.
+
+: xyz-magnitude ( x y z -- magnitude )
+ rot abs rot abs rot abs
+ 2dup > if swap then ( x min-y,z max-y,z )
+ rot 2dup > if swap then ( a b max )
+ -rot + 3 / + ( magnitude )
+;
+
+\ This is a coupling coefficient between the net velocity (laptop - ball)
+\ and the ball acceleration. It encapsulates various constant factors
+\ such as the drag coefficient and unit conversions. Its value is adjusted
+\ empirically to make the simulation work nicely.
+d# 1 d# 5 a/b>fraction value drag
+
+\ Compute the acceleration on the ball resulting from the drag of
+\ the differential velocity between the laptop and the ball.
+\ The formula for drag force is a "constant" times the magnitude of
+\ the velocity squared, in a direction opposite to the velocity.
+\ That can be represented as v^2 times a unit vector. But that
+\ unit vector is velocity-vector/velocity-magnitude. The magnitude
+\ in the denominator cancels one of the numerator ones, leaving
+\ velocity-magnitude * velocity-vector.
+
+: compute-drag ( -- acc-x,y,z )
+ vel-l vel-b xyz- ( vel-x,y,z )
+ 3dup xyz-magnitude ( vel-x,y,z velocity-magnitude )
+ drag fraction* ( vel-x,y,z drag-force )
+ xyz* ( acc-x,y,z )
+;
+[then]
+
+: inelastic ( vel -- vel' ) 5 * 3 >>a ;
+: -velx ( -- ) vel-b rot negate inelastic -rot to vel-b ; \ Invert the X component of ball velocity
+: -vely ( -- ) vel-b swap negate inelastic swap to vel-b ; \ Invert the Y component of ball velocity
+: -velz ( -- ) vel-b negate inelastic to vel-b ; \ Invert the Z component of ball velocity
+
+: live-walls ( x,y,z -- x',y',z' )
+ rot dup 0< if negate -velx then ( y z x' )
+ dup maxx >= if maxx 2* swap - -velx then ( y z x' )
+
+ rot dup 0< if negate -vely then ( z x y' )
+ dup maxy >= if maxy 2* swap - -vely then ( z x y' )
+
+ rot dup 0< if negate -velz then ( x y z' )
+ dup maxz >= if maxz 2* swap - -velz then ( x y z' )
+;
+: walls ( x,y,z -- x',y',z' )
+ rot dup 0< if drop 0 -velx then ( y z x' )
+ dup maxx >= if drop maxx -velx then ( y z x' )
+
+ rot dup 0< if drop 0 -vely then ( z x y' )
+ dup maxy >= if drop maxy -vely then ( z x y' )
+
+ rot dup 0< if drop 0 -velz then ( x y z' )
+ dup maxz >= if drop maxz -velz then ( x y z' )
+;
+
+: z>ball-radius ( z -- radius ) d# 20 / 1+ ;
+: xyz>screen ( x y z -- x' y' radius )
+\ maxy 1- rot - swap ( x y' z ) \ Invert Y axis
+ maxz 1- swap - ( x y z' ) \ Invert Z axis
+ xyz>integer ( x' y' z' )
+ ball-radius 1+ dup 0 xyz+ ( x' y' z' )
+ z>ball-radius ( x y radius )
+;
+: redraw ( new-xyz old-xyz -- )
+ 3swap xyz>screen 3swap xyz>screen ( new-xyr old-xyr )
+ 3over 3over xyz- or or if ( new-xyr old-xyr )
+ h# ffff set-fg circleat ( new-xyr )
+ 0 set-fg circleat ( )
+ else ( new-xyr old-xyr )
+ 3drop 3drop ( )
+ then ( )
+;
+
+
+[ifdef] notdef
+d# 20 >fraction constant small
+\ An unsuccessful attempt to eliminate ball jitter by reducing
+\ acceleration near the edges of the window.
+: clip-accel ( acc pos limit -- acc' )
+ over small <= if ( acc pos limit )
+ debug-me drop 0 max exit ( acc' )
+ then ( acc pos limit )
+ small - >= if ( acc )
+ 0 min ( acc' )
+ then ( acc )
+;
+[then]
+
+: net-acceleration ( -- acc-x,y,z )
+ get-acceleration ( acc-x,y,z )
+ acc-scale xyz* ( acc'-x,y,z )
+
+[ifdef] notdef
+ rot pos-b 2drop maxx clip-accel -rot ( acc-x',y,z )
+ swap pos-b drop nip maxy clip-accel swap ( acc-x,y',z )
+ pos-b nip nip maxz clip-accel ( acc-x,y',z' )
+[then]
+;
+
+[ifdef] notdef
+\ An unsuccessful attempt to eliminate ball jitter by forcing
+\ small numbers to 0.
+: clamp ( x,y,z -- x',y',z' )
+ rot dup abs small < if drop 0 then -rot
+ swap dup abs small < if drop 0 then swap
+ dup abs small < if drop 0 then
+;
+[then]
+
+: update-ball ( -- )
+[ifdef] notdef
+ compute-drag ( acc-x,y,z )
+ 3dup 1/2 xyz* vel-b xyz+ pos-b' xyz+ ( acc-x,y,z pos-x,y,z )
+[then]
+
+ net-acceleration ( acc-x,y,z )
+ 3dup 1/2 xyz* vel-b xyz+ pos-b xyz+ ( acc-x,y,z pos'-x,y,z )
+
+ 3swap vel-b damping xyz* xyz+ to vel-b ( acc-x,y,z )
+ walls ( pos'-x,y,z )
+ 3dup pos-b redraw ( pos'-x,y,z )
+ to pos-b ( )
+;
+
+: init-ball ( -- )
+ maxx maxy maxz 1/2 xyz* to pos-b
+ 0 0 0 to vel-b ( 0 0 0 to vel-l )
+;
+: roller ( -- )
+ init-accelerometer
+ init-ball
+ text-off
+ clear-drawing
+ begin ( update-laptop ) update-ball d# 50 ms key? until
+ text-on
+;
+
+\ 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
Author: wmb
Date: Sat Jun 4 08:48:27 2011
New Revision: 2244
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2244
Log:
Fixed decompiler problem - it was failing to display the names of some data types. The code to display them existed, but wasn't enabled due to a search order problem.
Modified:
forth/lib/objects.fth
Modified: forth/lib/objects.fth
==============================================================================
--- forth/lib/objects.fth Sat Jun 4 00:56:50 2011 (r2243)
+++ forth/lib/objects.fth Sat Jun 4 08:48:27 2011 (r2244)
@@ -160,6 +160,7 @@
-level \ Exit temporary compile state, perhaps run word
;
+also hidden
[ifdef] object-definer
: (object-definer) ( action-acf -- definer )
dup /n - @ ( action-acf #actions )
@@ -172,8 +173,9 @@
ta1+ dup probably-cfa?
until
;
-also hidden ' (object-definer) is object-definer previous
+' (object-definer) is object-definer
[then]
+previous
\ action-compiler: to
action-compiler: addr