[openfirmware] [commit] r3473 - in cpu/arm/olpc: . cl4
repository service
svn at openfirmware.info
Thu Dec 6 07:55:55 CET 2012
Author: quozl
Date: Thu Dec 6 07:55:54 2012
New Revision: 3473
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/3473
Log:
OLPC XO-4 - touchscreen and menu interaction, add reference counting to open/close, clean the buffer in stream-poll? so that previous events are not processed again, fix stack effect of selftest, close and reopen the touchscreen over the menu driven test of the touchscreen (not the best solution), all this for #12357.
Modified:
cpu/arm/olpc/cl4/testitems.fth
cpu/arm/olpc/nn-touchscreen.fth
Modified: cpu/arm/olpc/cl4/testitems.fth
==============================================================================
--- cpu/arm/olpc/cl4/testitems.fth Thu Dec 6 05:50:29 2012 (r3472)
+++ cpu/arm/olpc/cl4/testitems.fth Thu Dec 6 07:55:54 2012 (r3473)
@@ -34,8 +34,14 @@
: camera-item ( -- ) " /camera" gfx-test-dev ;
: wlan-item ( -- ) " /wlan" mfg-test-dev ;
: timer-item ( -- ) " /timer" mfg-test-dev ;
-: touch-item ( -- ) " /touchscreen" mfg-test-dev
- " mouse" mfg-test-dev ;
+: touch-item ( -- )
+ ?close-touchscreen
+ ?close-mouse
+ " /touchscreen" mfg-test-dev
+ " mouse" mfg-test-dev
+ ?open-mouse
+ ?open-touchscreen
+;
: keyboard-item ( -- ) " keyboard" mfg-test-dev ;
: switch-item ( -- ) " /accelerometer" mfg-test-dev
" /switches" mfg-test-dev ;
Modified: cpu/arm/olpc/nn-touchscreen.fth
==============================================================================
--- cpu/arm/olpc/nn-touchscreen.fth Thu Dec 6 05:50:29 2012 (r3472)
+++ cpu/arm/olpc/nn-touchscreen.fth Thu Dec 6 07:55:54 2012 (r3473)
@@ -157,35 +157,43 @@
then
;
+variable refcount 0 refcount !
+
: open ( -- okay? )
- pbuf-alloc
my-unit " set-address" $call-parent
- set-gpios
- no-data? if
- reset
+ refcount @ 0= if
+ pbuf-alloc
+ set-gpios
no-data? if
- ." no response to reset" cr
- pbuf-free false exit
+ reset
+ no-data? if
+ ." no response to reset" cr
+ pbuf-free false exit
+ then
+ ['] read-boot-complete catch ?dup if
+ .error
+ ." failed to boot" cr
+ pbuf-free false exit
+ then
+ else
+ flush-input
then
- ['] read-boot-complete catch ?dup if
+ ['] configure catch ?dup if
.error
- ." failed to boot" cr
+ ." failed to configure" cr
pbuf-free false exit
then
- else
- flush-input
- then
- ['] configure catch ?dup if
- .error
- ." failed to configure" cr
- pbuf-free false exit
then
+ refcount @ 1+ refcount !
true
;
: close
- deconfigure
- pbuf-free
+ refcount @ 1- 0 max refcount !
+ refcount @ 0= if
+ deconfigure
+ pbuf-free
+ then
;
: flush
@@ -194,6 +202,7 @@
;
: stream-poll? ( -- false | x y buttons true )
+ 0 pbuf 2+ c!
in? if
\ FIXME: only handles one subpacket
pbuf 2+ c@ h# 04 = if
@@ -1041,7 +1050,8 @@
['] open catch ?dup if
.error
." No touchscreen present" cr false exit
- then
+ then ( okay? )
+ 0= if false exit then
diagnostic-mode? if
0 to faults
More information about the openfirmware
mailing list