Author: quozl Date: Fri Aug 24 05:22:48 2012 New Revision: 3223 URL: http://tracker.coreboot.org/trac/openfirmware/changeset/3223
Log: OLPC XO-4 - Neonode, show meaningful error messages on open fail, factorise packet buffer allocation
Modified: cpu/arm/olpc/nn-touchscreen.fth
Modified: cpu/arm/olpc/nn-touchscreen.fth ============================================================================== --- cpu/arm/olpc/nn-touchscreen.fth Fri Aug 24 00:45:55 2012 (r3222) +++ cpu/arm/olpc/nn-touchscreen.fth Fri Aug 24 05:22:48 2012 (r3223) @@ -8,7 +8,9 @@ : targets? ( -- flag ) final-test? ; : .tsmsg ( -- ) 0 d# 27 at-xy ." Touchscreen test. Type a key to exit" cr ;
+[ifndef] set-geometry fload ${BP}/cpu/arm/olpc/touchscreen-common.fth +[then]
[ifndef] 2u.x : 2u.x base @ >r hex 0 <# # # #> type r> base ! ; @@ -26,6 +28,9 @@ 0 value plen 0 value configure?
+: pbuf-alloc /pbuf alloc-mem to pbuf ; +: pbuf-free pbuf /pbuf free-mem ; + : in? ( -- got-data? ) no-data? if false exit then
@@ -80,21 +85,30 @@ ;
: open ( -- okay? ) - /pbuf alloc-mem to pbuf + pbuf-alloc my-unit set-twsi-target set-gpios no-data? if reset - no-data? if pbuf /pbuf free-mem false exit then + no-data? if + ." no response to reset" cr + pbuf-free false exit + then + then + ['] read-boot-complete catch if + ." no response on bus" cr + pbuf-free false exit + then + ['] configure catch if + ." failed to configure" cr + pbuf-free false exit then - read-boot-complete - ['] configure catch if pbuf /pbuf free-mem false exit then true ;
: close deactivate - pbuf /pbuf free-mem + pbuf-free ;
: stream-poll? ( -- false | x y buttons true )
openfirmware@openfirmware.info