Author: wmb Date: 2009-09-10 10:21:31 +0200 (Thu, 10 Sep 2009) New Revision: 1357
Modified: dev/ps2mouse.fth Log: ps2mouse driver - timeout after 300 mS of cmd retries.
Modified: dev/ps2mouse.fth =================================================================== --- dev/ps2mouse.fth 2009-09-10 08:07:14 UTC (rev 1356) +++ dev/ps2mouse.fth 2009-09-10 08:21:31 UTC (rev 1357) @@ -36,15 +36,24 @@ : put-get-data ( cmd -- data ) " put-get-data" $call-parent ; : send-cmd ( cmd -- ) " put-data" $call-parent ;
+0 instance variable #retries : cmd? ( cmd -- error? ) + #retries off dup put-get-data ( cmd response ) begin ( cmd response ) case ( cmd response ) h# fa of drop false exit endof \ ACK - h# fe of dup put-get-data endof \ RESEND - try again + h# fe of ( cmd ) \ RESEND - try again + 1 #retries +! ( cmd ) + #retries @ d# 300 > if ( cmd ) + drop true exit + then ( cmd ) + 1 ms ( cmd ) + dup put-get-data ( cmd response ) + endof ( cmd response ) d# 10 timed-read if ( cmd response ) - 2drop true exit + 2drop true exit then ( cmd response new-response ) swap ( cmd new-response response ) endcase ( cmd new-response )