[Tinyos-2-commits] CVS: tinyos-2.x/tos/chips/cc1000 CC1000CsmaP.nc, 1.2, 1.3 CC1000CsmaRadioC.nc, 1.2, 1.3 CC1000RssiP.nc, 1.2, 1.3

David Gay idgay at users.sourceforge.net
Tue Aug 8 13:04:09 PDT 2006


Update of /cvsroot/tinyos/tinyos-2.x/tos/chips/cc1000
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv4969

Modified Files:
	CC1000CsmaP.nc CC1000CsmaRadioC.nc CC1000RssiP.nc 
Log Message:
lpl fixes:
- faster resource management using immediateRequest (~5% lifetime improvement)
- turn off radio before computing new squelch value (thanks to David Moss)
- fix bug that made radio sometimes stay on for long periods (2.5s) after send


Index: CC1000CsmaP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/cc1000/CC1000CsmaP.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** CC1000CsmaP.nc	12 Jul 2006 17:01:32 -0000	1.2
--- CC1000CsmaP.nc	8 Aug 2006 20:04:07 -0000	1.3
***************
*** 154,159 ****
  
    void radioOff() {
-     call ByteRadio.off();
      call CC1000Control.off();
    }
  
--- 154,159 ----
  
    void radioOff() {
      call CC1000Control.off();
+     call ByteRadio.off();
    }
  
***************
*** 235,243 ****
        case IDLE_STATE:
  	/* Timer already running means that we have a noise floor
! 	   measurement scheduled. */
  	if (!call WakeupTimer.isRunning())
  	  if (call CC1000Squelch.settled())
  	    {
! 	      if (lplRxPower == 0 || f.txPending)
  		call WakeupTimer.startOneShot(CC1K_SquelchIntervalSlow);
  	      else
--- 235,245 ----
        case IDLE_STATE:
  	/* Timer already running means that we have a noise floor
! 	   measurement scheduled. If we just set a new alarm here, we
! 	   might indefinitely delay noise floor measurements if we're,
! 	   e,g, transmitting frequently. */
  	if (!call WakeupTimer.isRunning())
  	  if (call CC1000Squelch.settled())
  	    {
! 	      if (lplRxPower == 0)
  		call WakeupTimer.startOneShot(CC1K_SquelchIntervalSlow);
  	      else
***************
*** 342,345 ****
--- 344,348 ----
      if (data > call CC1000Squelch.get() - (call CC1000Squelch.get() >> 2))
        {
+ 	post sleepCheck();
  	// don't be too agressive (ignore really quiet thresholds).
  	if (data < call CC1000Squelch.get() + (call CC1000Squelch.get() >> 3))
***************
*** 349,353 ****
  	    post adjustSquelch();
  	  }
- 	post sleepCheck();
        }
      else if (count++ > 5)
--- 352,355 ----

Index: CC1000CsmaRadioC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/cc1000/CC1000CsmaRadioC.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** CC1000CsmaRadioC.nc	12 Jul 2006 17:01:32 -0000	1.2
--- CC1000CsmaRadioC.nc	8 Aug 2006 20:04:07 -0000	1.3
***************
*** 109,112 ****
--- 109,113 ----
  
    Rssi.ActualRssi -> Hpl;
+   Rssi.Resource -> Hpl;
    Control.CC -> Hpl;
    Control.BusyWait -> BusyWaitMicroC;

Index: CC1000RssiP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/cc1000/CC1000RssiP.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** CC1000RssiP.nc	12 Jul 2006 17:01:32 -0000	1.2
--- CC1000RssiP.nc	8 Aug 2006 20:04:07 -0000	1.3
***************
*** 48,52 ****
      async command void cancel();
    }
!   uses interface Read<uint16_t> as ActualRssi;
  }
  implementation
--- 48,55 ----
      async command void cancel();
    }
!   uses {
!     interface Resource;
!     interface ReadNow<uint16_t> as ActualRssi;
!   }
  }
  implementation
***************
*** 66,82 ****
    }
  
!   void startNextOp() {
!     if (nextOp != IDLE)
!       {
! 	currentOp = nextOp;
! 	nextOp = IDLE;
! 	call ActualRssi.read();
!       }
!     else
!       currentOp = IDLE;
!   }
! 
!   task void startOpTask() {
!     atomic startNextOp();
    }
  
--- 69,74 ----
    }
  
!   event void Resource.granted() {
!     call ActualRssi.read();
    }
  
***************
*** 84,106 ****
      if (currentOp == IDLE)
        {
! 	nextOp = reason;
! 	post startOpTask();
        }
!     else // We should only come here with currentOp = CANCELLED
        nextOp = reason;
      return SUCCESS;
    }
  
!   event void ActualRssi.readDone(error_t result, uint16_t data) {
!     atomic
        {
! 	uint8_t op = currentOp;
  
  	/* The code assumes that RSSI measurements are 10-bits 
  	   (legacy effect) */
! 	data >>= 6;
  	startNextOp();
- 
- 	signal Rssi.readDone[op](result, data);
        }
    }
--- 76,108 ----
      if (currentOp == IDLE)
        {
! 	currentOp = reason;
! 	if (call Resource.immediateRequest() == SUCCESS)
! 	  call ActualRssi.read();
! 	else
! 	  call Resource.request();
        }
!     else
        nextOp = reason;
      return SUCCESS;
    }
  
!   void startNextOp() {
!     currentOp = nextOp;
!     if (nextOp != IDLE)
        {
! 	nextOp = IDLE;
! 	call ActualRssi.read();
!       }
!     else
!       call Resource.release();
!   }
  
+   async event void ActualRssi.readDone(error_t result, uint16_t data) {
+     atomic
+       {
  	/* The code assumes that RSSI measurements are 10-bits 
  	   (legacy effect) */
! 	signal Rssi.readDone[currentOp](result, data >> 6);
  	startNextOp();
        }
    }



More information about the Tinyos-2-commits mailing list