Author: wmb Date: 2007-05-09 20:42:03 +0200 (Wed, 09 May 2007) New Revision: 368
Modified: cpu/x86/pc/olpc/devices.fth cpu/x86/pc/olpc/fw.bth dev/olpc/kb3700/ecio.fth Log: OLPC - Fixed a problem with the EC command protocol and reverted to the use of it for board ID and game-key interaction.
Modified: cpu/x86/pc/olpc/devices.fth =================================================================== --- cpu/x86/pc/olpc/devices.fth 2007-05-07 21:32:22 UTC (rev 367) +++ cpu/x86/pc/olpc/devices.fth 2007-05-09 18:42:03 UTC (rev 368) @@ -242,8 +242,7 @@ h# a18 else lx? if -\ board-id@ case - snoop-board-id@ case + board-id@ case h# b2 of h# b30 endof \ preB3 ( board-id ) dup h# 10 * 8 + swap \ E.g. b3 -> b38 endcase
Modified: cpu/x86/pc/olpc/fw.bth =================================================================== --- cpu/x86/pc/olpc/fw.bth 2007-05-07 21:32:22 UTC (rev 367) +++ cpu/x86/pc/olpc/fw.bth 2007-05-09 18:42:03 UTC (rev 368) @@ -432,7 +432,7 @@
: user-switch? ( -- flag ) [ifdef] lx-devel false exit [then] -true exit + atest? if true exit then game-key@ 0<> dup if ." Release the game key to continue" cr begin d# 100 ms game-key@ 0= until
Modified: dev/olpc/kb3700/ecio.fth =================================================================== --- dev/olpc/kb3700/ecio.fth 2007-05-07 21:32:22 UTC (rev 367) +++ dev/olpc/kb3700/ecio.fth 2007-05-09 18:42:03 UTC (rev 368) @@ -44,18 +44,18 @@
: ec-release ( -- ) h# ff h# 6c pc! 1 ms h# 68 pc@ drop ; : ec-wait-wr ( -- ) - d# 70 0 do + d# 140 0 do ec-cmd@ 2 and 0= if unloop exit then - d# 10 ms + 5 ms loop ." EC write timed out" cr ; \ Empirically, it can take a long time for the EC to sense the game \ keys when several are down at once. 500 mS is not enough. : ec-wait-rd ( -- ) - d# 70 0 do + d# 700 0 do ec-cmd@ 1 and if unloop exit then - d# 10 ms + d# 1 ms loop ." EC read timed out" cr ; @@ -70,7 +70,7 @@ ec-cmd@ ( 6c-val ) repeat ( 6c-val ) ; -: ec-cmd! ( b -- ) ec-wait-wr h# 6c pc! ( ec-wait-wr ) ; +: ec-cmd! ( b -- ) ec-wait-wr h# 6c pc! ec-wait-wr ;
: ec-dat@ ( -- b ) ec-wait-rd h# 68 pc@ ; : ec-dat! ( b -- ) ec-wait-wr h# 68 pc! ; @@ -94,9 +94,9 @@ : ambient-temp@ ( -- w ) h# 14 ec-cmd-w@ ; : bat-status@ ( -- b ) h# 15 ec-cmd-b@ ; : bat-soc@ ( -- b ) h# 16 ec-cmd-b@ ; -: bat-gauge-id@ ( -- l.sn4-7 l.sn0-3 ) +: bat-gauge-id@ ( -- sn0 .. sn7 ) h# 17 ec-cmda - ec-rw ec-rw swap wljoin ec-rw ec-rw swap wljoin swap + 8 0 do ec-rb loop ec-release ; : bat-gauge@ ( -- b ) h# 18 ec-cmda h# 31 ec-wb ec-dat@ ec-release ; \ 31 is the EEPROM address