]> oss.titaniummirror.com Git - tinyos-2.x.git/blobdiff - tos/chips/cc2420/spi/CC2420SpiP.nc
turn on safe compilation for some modules
[tinyos-2.x.git] / tos / chips / cc2420 / spi / CC2420SpiP.nc
index 6db6a4ed3a9170eedb2f8681f03779d5caa88765..d725e6f0ba48b7f0ab1a353b585867b80a89c056 100644 (file)
@@ -38,7 +38,7 @@
  * @version $Revision$ $Date$
  */
 
-module CC2420SpiP {
+module CC2420SpiP @safe() {
 
   provides {
     interface ChipSpiResource;
@@ -262,6 +262,8 @@ implementation {
                                                             uint8_t len ) {
 
     cc2420_status_t status = 0;
+    uint8_t tmpLen = len;
+    uint8_t * COUNT(tmpLen) tmpData = (uint8_t * COUNT(tmpLen))data;
 
     atomic {
       if(call WorkingState.isIdle()) {
@@ -274,7 +276,7 @@ implementation {
     status = call SpiByte.write( addr | 0x80 );
     call SpiByte.write( ( addr >> 1 ) & 0xc0 );
     for ( ; len; len-- ) {
-      call SpiByte.write( *data++ );
+      call SpiByte.write( tmpData[tmpLen-len] );
     }
 
     return status;