Author: quozl Date: Thu Aug 9 10:27:52 2012 New Revision: 3141 URL: http://tracker.coreboot.org/trac/openfirmware/changeset/3141
Log: ARM - TWSI, add twsi-read for reading bytes from a device into a buffer
Modified: cpu/arm/mmp2/twsi.fth
Modified: cpu/arm/mmp2/twsi.fth ============================================================================== --- cpu/arm/mmp2/twsi.fth Thu Aug 9 03:49:54 2012 (r3140) +++ cpu/arm/mmp2/twsi.fth Thu Aug 9 10:27:52 2012 (r3141) @@ -151,6 +151,13 @@ 1- 0 ?do dup c@ 0 twsi-putbyte 1+ loop ( adr' ) c@ bbu_ICR_STOP twsi-putbyte ( ) ; +: twsi-read ( adr len -- ) + dup 0= if 2drop exit then ( adr len ) + slave-address 1 or twsi-start ( adr len ) + + 1- 0 ?do 0 twsi-getbyte over c! 1+ loop ( adr' ) + bbu_ICR_STOP bbu_ICR_ACKNAK or twsi-getbyte swap c! ( ) +;
: twsi-b@ ( reg -- byte ) 1 1 twsi-get ; : twsi-b! ( byte reg -- ) 2 twsi-out ;
openfirmware@openfirmware.info