[Tinyos-2-commits] CVS: tinyos-2.x/tos/chips/atm128/spi Atm128SpiC.nc, 1.5, 1.6 Atm128SpiP.nc, 1.9, 1.10
Miklos Maroti
mmaroti at users.sourceforge.net
Mon Mar 9 11:13:01 PDT 2009
Update of /cvsroot/tinyos/tinyos-2.x/tos/chips/atm128/spi
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv10895
Modified Files:
Atm128SpiC.nc Atm128SpiP.nc
Log Message:
make the FastSpiByte interface generic and implement it in Atm128Spi
Index: Atm128SpiC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/atm128/spi/Atm128SpiC.nc,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** Atm128SpiC.nc 24 Apr 2008 22:31:25 -0000 1.5
--- Atm128SpiC.nc 9 Mar 2009 18:12:58 -0000 1.6
***************
*** 66,69 ****
--- 66,70 ----
provides interface Init;
provides interface SpiByte;
+ provides interface FastSpiByte;
provides interface SpiPacket;
provides interface Resource[uint8_t id];
***************
*** 77,80 ****
--- 78,82 ----
SpiByte = SpiMaster;
+ FastSpiByte = SpiMaster;
SpiPacket = SpiMaster;
Resource = SpiMaster;
Index: Atm128SpiP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/atm128/spi/Atm128SpiP.nc,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** Atm128SpiP.nc 23 Jun 2008 20:25:15 -0000 1.9
--- Atm128SpiP.nc 9 Mar 2009 18:12:59 -0000 1.10
***************
*** 77,80 ****
--- 77,81 ----
interface Init;
interface SpiByte;
+ interface FastSpiByte;
interface SpiPacket;
interface Resource[uint8_t id];
***************
*** 126,131 ****
async command uint8_t SpiByte.write( uint8_t tx ) {
! call Spi.enableSpi(TRUE);
! call McuPowerState.update();
call Spi.write( tx );
while ( !( SPSR & 0x80 ) );
--- 127,134 ----
async command uint8_t SpiByte.write( uint8_t tx ) {
! /* no need to enable the SPI bus since that must have been done
! when the resource was granted */
! // call Spi.enableSpi(TRUE);
! // call McuPowerState.update();
call Spi.write( tx );
while ( !( SPSR & 0x80 ) );
***************
*** 133,136 ****
--- 136,166 ----
}
+ inline async command void FastSpiByte.splitWrite(uint8_t data) {
+ call Spi.write(data);
+ }
+
+ inline async command uint8_t FastSpiByte.splitRead() {
+ while( !( SPSR & 0x80 ) )
+ ;
+ return call Spi.read();
+ }
+
+ inline async command uint8_t FastSpiByte.splitReadWrite(uint8_t data) {
+ uint8_t b;
+
+ while( !( SPSR & 0x80 ) )
+ ;
+ b = call Spi.read();
+ call Spi.write(data);
+
+ return b;
+ }
+
+ inline async command uint8_t FastSpiByte.write(uint8_t data) {
+ call Spi.write(data);
+ while( !( SPSR & 0x80 ) )
+ ;
+ return call Spi.read();
+ }
/**
More information about the Tinyos-2-commits
mailing list