[Tinyos-2-commits] CVS: tinyos-2.x/tos/platforms/telosb/mac/tkn154 Ieee802154MacC.nc, 1.2, 1.3 Makefile.include, 1.1, 1.2 TKN154_platform.h, 1.1, 1.2 TKN154TimingP.nc, 1.1, 1.2

Jan-Hinrich Hauer janhauer at users.sourceforge.net
Tue Nov 25 01:35:11 PST 2008


Update of /cvsroot/tinyos/tinyos-2.x/tos/platforms/telosb/mac/tkn154
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv21632/tos/platforms/telosb/mac/tkn154

Modified Files:
	Ieee802154MacC.nc Makefile.include TKN154_platform.h 
	TKN154TimingP.nc 
Log Message:
+ modified radio driver (PHY) interfaces: CSMA-CA algorithm is now pushed to radio driver
+ adapted CC2420 driver
+ renamed CsmaP -> FrameDispatchP
+ provided workaround for a problem with virtualized alarms (sometimes they seem to fire 2s too late)
+ updated placeholder components
+ updated debug information

Index: Ieee802154MacC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/platforms/telosb/mac/tkn154/Ieee802154MacC.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Ieee802154MacC.nc	25 Jun 2008 10:19:04 -0000	1.2
--- Ieee802154MacC.nc	25 Nov 2008 09:35:09 -0000	1.3
***************
*** 96,101 ****
  
    components CC2420TKN154C as PHY,
!              new Alarm62500hz32VirtualizedC() as PHYAlarm1,
               new Alarm62500hz32VirtualizedC() as PHYAlarm2,
               LocalTime62500hzC, TKN154TimingP;
  
--- 96,102 ----
  
    components CC2420TKN154C as PHY,
!              new Alarm62500hz32C() as PHYAlarm1,
               new Alarm62500hz32VirtualizedC() as PHYAlarm2,
+              new Alarm62500hz32C() as TKN154TimingPAlarm,
               LocalTime62500hzC, TKN154TimingP;
  
***************
*** 118,122 ****
    PHY.Leds -> LedsC;
    TKN154TimingP.TimeCalc -> MAC;
!   TKN154TimingP.LocalTime -> LocalTime62500hzC;
  
    components new Alarm62500hz32VirtualizedC() as  MACAlarm1,
--- 119,124 ----
    PHY.Leds -> LedsC;
    TKN154TimingP.TimeCalc -> MAC;
!   TKN154TimingP.Leds -> LedsC;
!   TKN154TimingP.SymbolAlarm -> TKN154TimingPAlarm;
  
    components new Alarm62500hz32VirtualizedC() as  MACAlarm1,
***************
*** 165,168 ****
--- 167,171 ----
    MAC.Random -> RandomC;
    MAC.Leds -> LedsC;
+   PHY.Random -> RandomC;
  
  #ifdef TKN154_SERIAL_DEBUG

Index: Makefile.include
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/platforms/telosb/mac/tkn154/Makefile.include,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Makefile.include	16 Jun 2008 18:05:14 -0000	1.1
--- Makefile.include	25 Nov 2008 09:35:09 -0000	1.2
***************
*** 1,2 ****
--- 1,6 ----
+ ifdef TKN154_PIERCEBOARD
+ CFLAGS += -I$(TOSDIR)/platforms/telosb/mac/tkn154/timer/pierceboard
+ endif
+ 
  CFLAGS += -I$(TOSDIR)/platforms/telosb/mac/tkn154 \
  	-I$(TOSDIR)/platforms/telosb/mac/tkn154/timer \

Index: TKN154_platform.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/platforms/telosb/mac/tkn154/TKN154_platform.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** TKN154_platform.h	16 Jun 2008 18:05:14 -0000	1.1
--- TKN154_platform.h	25 Nov 2008 09:35:09 -0000	1.2
***************
*** 44,48 ****
  enum {
    // guard time to give up the token before actual end of CAP/CFP
!   IEEE154_RADIO_GUARD_TIME = 1000,
  
    // the expected time for a RadioTx.prepare() operation to execute (return)
--- 44,48 ----
  enum {
    // guard time to give up the token before actual end of CAP/CFP
!   IEEE154_ACTIVE_PERIOD_GUARD_TIME = 300,
  
    // the expected time for a RadioTx.prepare() operation to execute (return)

Index: TKN154TimingP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/platforms/telosb/mac/tkn154/TKN154TimingP.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** TKN154TimingP.nc	16 Jun 2008 18:05:14 -0000	1.1
--- TKN154TimingP.nc	25 Nov 2008 09:35:09 -0000	1.2
***************
*** 35,44 ****
  
  /** 
-  * NOTE:
   * In slotted CSMA-CA frames must be sent on backoff boundaries (slot width:
!  * 320 us). On TelosB the only clock source with sufficient accuracy is the
!  * external quartz, unfortunately it is not precise enough (32.768 Hz).
!  * Therefore, currently the following code is not even trying to achieve
!  * accurate timing. 
   */
  
--- 35,41 ----
  
  /** 
   * In slotted CSMA-CA frames must be sent on backoff boundaries (slot width:
!  * 320 us). The TelosB platform lacks a clock with sufficient precision/
!  * accuracy, i.e. for slotted CSMA-CA the timing is *not* standard compliant.
   */
  
***************
*** 50,62 ****
    provides interface ReferenceTime;
    uses interface TimeCalc;
!   uses interface LocalTime<T62500hz>;
  }
  implementation
  {
! 
! #define UWAIT1 nop();nop();nop();nop()
! #define UWAIT2 UWAIT1;UWAIT1
! #define UWAIT4 UWAIT2;UWAIT2
! #define UWAIT8 UWAIT4;UWAIT4
  
    async command void CaptureTime.convert(uint16_t time, ieee154_reftime_t *localTime, int16_t offset)
--- 47,62 ----
    provides interface ReferenceTime;
    uses interface TimeCalc;
!   uses interface Alarm<T62500hz,uint32_t> as SymbolAlarm;
!   uses interface Leds;
  }
  implementation
  {
!   enum {
!     S_WAIT_OFF,
!     S_WAIT_RX,
!     S_WAIT_TX,
!     S_WAIT_BACKOFF,
!   };
!   uint8_t m_state = S_WAIT_OFF;
  
    async command void CaptureTime.convert(uint16_t time, ieee154_reftime_t *localTime, int16_t offset)
***************
*** 66,70 ****
      // With the 32768Hz quartz we don't have enough precision anyway,
      // so the code below generates a timestamp that is not accurate
!     // (deviating about +-50 microseconds; this could probably
      // improved if we don't go through LocalTime)
      uint16_t tbr1, tbr2, delta;
--- 66,70 ----
      // With the 32768Hz quartz we don't have enough precision anyway,
      // so the code below generates a timestamp that is not accurate
!     // (deviating about +-50 microseconds, which could probably
      // improved if we don't go through LocalTime)
      uint16_t tbr1, tbr2, delta;
***************
*** 75,79 ****
          tbr2 = TBR;
        } while (tbr1 != tbr2); // majority vote required (see msp430 manual)
!       now = call LocalTime.get(); 
      }
      if (time < tbr1)
--- 75,79 ----
          tbr2 = TBR;
        } while (tbr1 != tbr2); // majority vote required (see msp430 manual)
!       now = call SymbolAlarm.getNow(); 
      }
      if (time < tbr1)
***************
*** 86,118 ****
    async command void ReliableWait.busyWait(uint16_t dt)
    {
!     uint32_t start = call LocalTime.get();
!     while (!call TimeCalc.hasExpired(start, dt))
!       ;
    }
  
!   async command void ReliableWait.waitCCA(ieee154_reftime_t *t0, uint16_t dt)
    {
!     while (!call TimeCalc.hasExpired(*t0, dt))
!       ;
!     signal ReliableWait.waitCCADone();
    }
  
    async command void ReliableWait.waitTx(ieee154_reftime_t *t0, uint16_t dt)
    {
!     while (!call TimeCalc.hasExpired(*t0, dt))
!       ;
!     signal ReliableWait.waitTxDone();
    }
  
!   async command void ReliableWait.waitRx(ieee154_reftime_t *t0, uint16_t dt)
    {
!     while (!call TimeCalc.hasExpired(*t0, dt))
!       ;
!     signal ReliableWait.waitRxDone();
    }
!  
    async command void ReferenceTime.getNow(ieee154_reftime_t* reftime, uint16_t dt)
    {
!     *reftime = call LocalTime.get();
    }
  
--- 86,159 ----
    async command void ReliableWait.busyWait(uint16_t dt)
    {
!     uint16_t tbr1, tbr2, tbrVal;
!     atomic {
!       do {
!         tbr1 = TBR;
!         tbr2 = TBR;
!       } while (tbr1 != tbr2); // majority vote required (see msp430 manual)
!     }
!     tbrVal = tbr1 + dt;
!     atomic {
!       do {
!         tbr1 = TBR;
!         tbr2 = TBR;
!       } while (tbr1 != tbr2 || tbr1 != tbrVal); // majority vote required (see msp430 manual)
!     }
    }
  
!   async command void ReliableWait.waitRx(ieee154_reftime_t *t0, uint16_t dt)
    {
!     if (m_state != S_WAIT_OFF){
!       call Leds.led0On();
!       return;
!     }
!     m_state = S_WAIT_RX;
!     call SymbolAlarm.startAt(*t0 - 12, dt); // subtract 12 symbols required for Rx calibration
!     //signal SymbolAlarm.fired();
    }
  
    async command void ReliableWait.waitTx(ieee154_reftime_t *t0, uint16_t dt)
    {
!     if (m_state != S_WAIT_OFF){
!       call Leds.led0On();
!       return;
!     }
!     m_state = S_WAIT_TX;
!     call SymbolAlarm.startAt(*t0 - 12, dt); // subtract 12 symbols required for Tx calibration
!   }
!     
!   async command void ReliableWait.waitBackoff(ieee154_reftime_t *t0, uint16_t dt)
!   {
!     if (m_state != S_WAIT_OFF){
!       call Leds.led0On();
!       return;
!     }
!     m_state = S_WAIT_BACKOFF;
!     call SymbolAlarm.startAt(*t0, dt);
!     //signal SymbolAlarm.fired();
    }
  
!   async event void SymbolAlarm.fired() 
    {
!     switch (m_state)
!     {
!       case S_WAIT_RX: m_state = S_WAIT_OFF; signal ReliableWait.waitRxDone(); break;
!       case S_WAIT_TX: m_state = S_WAIT_OFF; signal ReliableWait.waitTxDone(); break;
!       case S_WAIT_BACKOFF: m_state = S_WAIT_OFF; signal ReliableWait.waitBackoffDone(); break;
!       default: call Leds.led0On(); break;
!     }
    }
! 
!   async command void ReliableWait.busyWaitSlotBoundaryCCA(ieee154_reftime_t *t0, uint16_t *dt) { }
!   async command void ReliableWait.busyWaitSlotBoundaryTx(ieee154_reftime_t *t0, uint16_t dt) 
!   { 
!     // we cannot meet the timing constraints, but there should at least roughly
!     // be 20 symbols between the first and the seconds CCA
!     call ReliableWait.busyWait(20);
!   }
! 
    async command void ReferenceTime.getNow(ieee154_reftime_t* reftime, uint16_t dt)
    {
!     *reftime = call SymbolAlarm.getNow() + dt;
    }
  



More information about the Tinyos-2-commits mailing list