Author: pgf
Date: Tue Nov 8 13:05:09 2011
New Revision: 2672
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2672
Log:
reimplement game-key@ using gpio-pin@ rather than keypad-bit
we no longer use the keypad controller
Modified:
cpu/arm/olpc/1.75/fw.bth
Modified: cpu/arm/olpc/1.75/fw.bth
==============================================================================
--- cpu/arm/olpc/1.75/fw.bth Tue Nov 8 00:19:39 2011 (r2671)
+++ cpu/arm/olpc/1.75/fw.bth Tue Nov 8 13:05:09 2011 (r2672)
@@ -231,8 +231,10 @@
: close ;
end-package
+\ it seems to be difficult to get SoC wakeups from the keypad controller,
+\ so we set them up as gpio, instead.
+[ifdef] use_mmp2_keypad_control
fload ${BP}/cpu/arm/mmp2/keypad.fth
-[ifndef] cl2-a1
[ifdef] notdef \ CForth turns on the keypad; resetting it makes it not work
stand-init: keypad
keypad-on
@@ -259,6 +261,7 @@
d# 19 gpio-pin@ 0= if h# 01 or then \ Square
d# 20 gpio-pin@ 0= if h# 40 or then \ Rotate
[else]
+[ifdef] use_mmp2_keypad_control
d# 15 gpio-pin@ 0= if button-rotate or then ( n )
scan-keypad ( n keypad )
button-o h# 01 keypad-bit ( n' keypad )
@@ -270,6 +273,17 @@
rocker-down h# 40 keypad-bit ( n' keypad )
rocker-left h# 80 keypad-bit ( n' keypad )
drop ( n )
+[else]
+ d# 15 gpio-pin@ 0= if button-rotate or then
+ d# 16 gpio-pin@ 0= if button-o or then
+ d# 17 gpio-pin@ 0= if button-check or then
+ d# 18 gpio-pin@ 0= if button-x or then
+ d# 19 gpio-pin@ 0= if button-square or then
+ d# 20 gpio-pin@ 0= if rocker-up or then
+ d# 21 gpio-pin@ 0= if rocker-right or then
+ d# 22 gpio-pin@ 0= if rocker-down or then
+ d# 23 gpio-pin@ 0= if rocker-left or then
+[then]
[then]
;
Author: wmb
Date: Tue Nov 1 20:35:39 2011
New Revision: 2664
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2664
Log:
OLPC XO-1.75 - fixed several problems in twsi.fth:set-bus-speed
a) Formatting did not conform to the OFW convention (indent pitch 3)
b) Missing stack pictures
c) Use of "1- 100,000 <" instead of the clearer "100,000 <="
d) Use of and masks instead of clear "invert and" masks
e) Incorrect mask values - fields in register are 9 bits, not 8.
f) Calculate value for fast SCL instead of hardcoding it (in the wrong bit position)
g) Describe the derivation of the dividend values based on working backwards from the default values
Modified:
cpu/arm/mmp2/twsi.fth
Modified: cpu/arm/mmp2/twsi.fth
==============================================================================
--- cpu/arm/mmp2/twsi.fth Tue Nov 1 09:04:25 2011 (r2663)
+++ cpu/arm/mmp2/twsi.fth Tue Nov 1 20:35:39 2011 (r2664)
@@ -179,18 +179,24 @@
: set-bus-standard cr-set h# fffe7fff and to cr-set ;
: set-bus-fast cr-set h# fffe7fff and h# 8000 or to cr-set ;
-: set-bus-speed ( hz -- ) \ Useful range is 25,000 .. 100,000, or 400,000
- child-address set-twsi-target
- dup 1- d# 100,000 < if
- set-bus-standard
- d# 12,600,000 swap / h# 1ff min h# 7e max
- lcr@ h# ffff.ff00 and or lcr!
- else
- drop
- set-bus-fast
- lcr@ h# ffff.00ff and h# 0000.1d00 or lcr!
- then
+\ The dividends below (12,600,000 and 11,600,000) are chosen to give the
+\ same values that the LCR defaults to for the data rates 100,000 and 400,000
+\ The TWSI input clock is the 26 MHz VCXO, and the divided value generates
+\ both the low phase and the high phase, so you would think that the dividend
+\ should be 13,000,000 (half of 26M), but that doesn't give the right result.
+\ Perhaps there is an additive factor in the divisor; the manual is quite vague.
+: set-bus-speed ( hz -- ) \ Useful range is 25K .. 400K - 100K and 400K are typical
+ child-address set-twsi-target ( hz )
+ dup d# 100,000 <= if ( hz )
+ set-bus-standard ( hz )
+ d# 12,600,000 swap / h# 1ff min h# 7e max ( divisor )
+ lcr@ h# 1ff invert and or lcr! ( )
+ else ( hz )
+ set-bus-fast ( hz )
+ d# 11,600,000 swap / h# 1ff min h# 1d max ( divisor )
+ lcr@ h# 3.fe00 invert and swap 9 lshift or lcr! ( )
+ then ( )
;
: decode-unit ( adr len -- low high ) parse-2int ;
: encode-unit ( low high -- adr len ) >r <# u#s drop [char] , hold r> u#s u#> ;