Author: quozl
Date: Sat Mar 17 02:51:04 2012
New Revision: 2897
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2897
Log:
OLPC - stack effect comment fixes
Modified:
cpu/arm/mmp2/hash.fth
cpu/arm/olpc/rtc.fth
Modified: cpu/arm/mmp2/hash.fth
==============================================================================
--- cpu/arm/mmp2/hash.fth Fri Mar 16 23:18:06 2012 (r2896)
+++ cpu/arm/mmp2/hash.fth Sat Mar 17 02:51:04 2012 (r2897)
@@ -69,7 +69,7 @@
0 to #hash-buf
then
;
-: hash-update ( adr len -- adr' len' )
+: hash-update ( adr len -- )
dup #hashed + to #hashed ( adr len )
begin dup while ( adr len )
2dup /hash-block #hash-buf - min ( adr len adr this )
Modified: cpu/arm/olpc/rtc.fth
==============================================================================
--- cpu/arm/olpc/rtc.fth Fri Mar 16 23:18:06 2012 (r2896)
+++ cpu/arm/olpc/rtc.fth Sat Mar 17 02:51:04 2012 (r2897)
@@ -77,7 +77,7 @@
then
get-time .date space .time cr
get-time 2nip 2nip nip
- d# 2011 < dup if ." Date in RTC is too early" cr then
+ d# 2011 < dup if ." Date in RTC is too early" cr then ( -- flag )
close
;
Author: wmb
Date: Fri Mar 16 23:18:06 2012
New Revision: 2896
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2896
Log:
OLPC XO-1.75 - trac #11704 - Raydium touchscreen driver - calibrate touchscreen during selftest and don't hang indefinitely if the touchscreen is spewing events.
Modified:
cpu/arm/olpc/exc7200-touchscreen.fth
cpu/arm/olpc/rm3150-touchscreen.fth
cpu/arm/olpc/touchscreen-common.fth
Modified: cpu/arm/olpc/exc7200-touchscreen.fth
==============================================================================
--- cpu/arm/olpc/exc7200-touchscreen.fth Fri Mar 16 02:04:15 2012 (r2895)
+++ cpu/arm/olpc/exc7200-touchscreen.fth Fri Mar 16 23:18:06 2012 (r2896)
@@ -53,6 +53,7 @@
begin
pad? if . . . . . cr then
key? until
+ key drop
;
: track ( x y z down? contact# -- )
Modified: cpu/arm/olpc/rm3150-touchscreen.fth
==============================================================================
--- cpu/arm/olpc/rm3150-touchscreen.fth Fri Mar 16 02:04:15 2012 (r2895)
+++ cpu/arm/olpc/rm3150-touchscreen.fth Fri Mar 16 23:18:06 2012 (r2896)
@@ -95,6 +95,9 @@
;
: discard-n ( .. #events -- ) 5 * 0 ?do drop loop ;
+\ Needs 2 seconds of no-touch
+: calibrate ( -- ) h# 20 0 ts-b! ;
+
: selftest ( -- error? )
open 0= if
\ ." Touchscreen open failed" true exit
@@ -104,7 +107,12 @@
\ Being able to open the touchpad is good enough in SMT mode
smt-test? if close false exit then
- final-test? 0= if
+ calibrate \ Needs 2 seconds of no-touch
+
+ targets? if
+ ." Calibrating touchscreen" cr
+ d# 2000 ms
+ else
." Touchscreen test will start in 4 seconds" cr
d# 4000 ms
then
@@ -115,7 +123,10 @@
begin key? while key drop repeat
\ Consume already-queued trackpad events to prevent premature exit
- begin pad-events ?dup while discard-n repeat
+ d# 100 0 do
+ pad-events ?dup 0= if leave then ( .. #events )
+ discard-n ( )
+ loop
background
begin
Modified: cpu/arm/olpc/touchscreen-common.fth
==============================================================================
--- cpu/arm/olpc/touchscreen-common.fth Fri Mar 16 02:04:15 2012 (r2895)
+++ cpu/arm/olpc/touchscreen-common.fth Fri Mar 16 23:18:06 2012 (r2896)
@@ -143,8 +143,6 @@
pixcolor !
;
-: handle-key ( -- exit? ) true ;
-
false value selftest-failed? \ Success/failure flag for final test mode
: exit-test? ( -- flag )
targets? if ( )
@@ -165,7 +163,7 @@
then ( )
\ If not final test mode, we only exit via a key - no targets
- key? if handle-key else false then ( exit ? )
+ key? dup if key drop then ( exit? )
;
0 value pressure
Author: wmb
Date: Fri Mar 16 02:02:28 2012
New Revision: 2894
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2894
Log:
ARM MMP2 timer driver - improved the code that reads the timer values. The technique I was using to ensure a self-consistent read was bogus, and the hardware documentation is extremely unclear. It turns out that you need to use different techniques for the different timers - careful write/read synchronization for the fast one, and read-until-match for the slower ones.
Modified:
cpu/arm/mmp2/timer.fth
Modified: cpu/arm/mmp2/timer.fth
==============================================================================
--- cpu/arm/mmp2/timer.fth Thu Mar 15 00:19:06 2012 (r2893)
+++ cpu/arm/mmp2/timer.fth Fri Mar 16 02:02:28 2012 (r2894)
@@ -21,37 +21,46 @@
7 h# 84 timer!
;
-[ifdef] arm-assembler
+\ The first ldr usually returns stale data; the second one returns good data.
+\ Empirically, draining the write buffer does not help.
+\ Read-until-match doesn't work with the fast clock because it never matches.
code timer0@ ( -- n ) \ 6.5 MHz
psh tos,sp
set r1,`h# 014000 +io #`
mov r0,#1
str r0,[r1,#0xa4]
- mov r0,r0
- ldr tos,[r1,#0x28]
+ ldr tos,[r1,#0xa4]
+ ldr tos,[r1,#0xa4]
c;
+\ For the slower timers, we use the read-until-match technique.
+\ Apparently the freeze register doesn't update until the next
+\ clock tick, so using it doesn't work well for the slow clocks.
code timer1@ ( -- n ) \ 32.768 kHz
psh tos,sp
set r1,`h# 014000 +io #`
- mov r0,#1
- str r0,[r1,#0xa8]
- mov r0,r0
ldr tos,[r1,#0x2c]
+ begin
+ mov r0,tos
+ ldr tos,[r1,#0x2c]
+ cmps tos,r0
+ = until
c;
code timer2@ ( -- n ) \ 1 kHz
psh tos,sp
set r1,`h# 014000 +io #`
- mov r0,#1
- str r0,[r1,#0xac]
- mov r0,r0
ldr tos,[r1,#0x30]
+ begin
+ mov r0,tos
+ ldr tos,[r1,#0x30]
+ cmps tos,r0
+ = until
c;
[else]
-: timer0@ ( -- n ) 1 h# 0140a4 io! h# 014028 io@ ;
-: timer1@ ( -- n ) 1 h# 0140a8 io! h# 01402c io@ ;
-: timer2@ ( -- n ) 1 h# 0140ac io! h# 014030 io@ ;
+: timer0@ ( -- n ) 1 h# 0140a4 io! h# 0140a4 io@ drop h# 0140a4 io@ ;
+: timer1@ ( -- n ) 1 h# 0140a8 io! h# 0140a8 io@ drop h# 0140a8 io@ ;
+: timer2@ ( -- n ) 1 h# 0140ac io! h# 0140ac io@ drop h# 0140ac io@ ;
[then]
: timer0-status@ ( -- n ) h# 014034 io@ ;