[OpenBIOS] r448 - dev/olpc/dcon
svn at openbios.org
svn at openbios.org
Fri Jun 15 21:19:29 CEST 2007
Author: wmb
Date: 2007-06-15 21:19:29 +0200 (Fri, 15 Jun 2007)
New Revision: 448
Modified:
dev/olpc/dcon/dconsmb.fth
Log:
OLPC DCON SMBus - The handling of missing ACKs from the device was wrong;
the code wasn't waiting for the address cycle to finish before looking for the ACK.
Modified: dev/olpc/dcon/dconsmb.fth
===================================================================
--- dev/olpc/dcon/dconsmb.fth 2007-06-14 09:42:50 UTC (rev 447)
+++ dev/olpc/dcon/dconsmb.fth 2007-06-15 19:19:29 UTC (rev 448)
@@ -29,8 +29,17 @@
: smb-init ( -- ) smb-on smb-stop smb-off smb-on ;
: smb-status ( -- b )
- 1 smb@ dup 1 smb!
- dup h# 20 and abort" SMB Bus conflict"
+ 1 smb@ ( dup 1 smb! )
+ dup h# 20 and if
+ smb-stop
+ h# 20 1 smb!
+ true abort" SMB Bus conflict"
+ then
+ dup h# 10 and if
+ smb-stop
+ h# 10 1 smb! \ Acknowledge NEGACK, only works after stop
+ true abort" No ACK"
+ then
;
: wait-ready ( -- )
@@ -42,10 +51,7 @@
true abort" SMB wait-ready timed out"
;
-: smb-byte-out ( b -- )
- wait-ready 0 smb!
- smb-status h# 10 and abort" No ACK"
-;
+: smb-byte-out ( b -- ) wait-ready 0 smb! ;
: wait-start ( -- )
d# 1000 0 do
@@ -57,15 +63,12 @@
;
: smb-start ( addr-byte -- )
1 3 smb! \ Start condition
-
wait-start
-
smb-byte-out \ Send address and R/W
;
-
: dcon@ ( reg# -- w )
- h# 1a smb-start smb-byte-out \ Address and reg#
+ h# 1a smb-start smb-byte-out wait-ready \ Address and reg#
h# 1b smb-start \ Switch to read
wait-ready
0 smb@ ( low-byte )
More information about the OpenBIOS
mailing list