[Tinyos-2-commits] CVS: tinyos-2.x/tos/chips/cc2420/transmit CC2420TransmitP.nc, 1.11, 1.12

kusy kusy at users.sourceforge.net
Sun Mar 1 23:02:34 PST 2009


Update of /cvsroot/tinyos/tinyos-2.x/tos/chips/cc2420/transmit
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv18696

Modified Files:
	CC2420TransmitP.nc 
Log Message:
timestamping patch: improved test to fall-through on SFD

Index: CC2420TransmitP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/cc2420/transmit/CC2420TransmitP.nc,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** CC2420TransmitP.nc	6 Feb 2009 06:38:49 -0000	1.11
--- CC2420TransmitP.nc	2 Mar 2009 07:02:32 -0000	1.12
***************
*** 258,261 ****
--- 258,262 ----
    async event void CaptureSFD.captured( uint16_t time ) {
      uint32_t time32;
+     uint8_t sfd_state = 0;
      atomic {
        time32 = getTime32(time);
***************
*** 265,268 ****
--- 266,272 ----
          m_state = S_EFD;
          sfdHigh = TRUE;
+         // in case we got stuck in the receive SFD interrupts, we can reset
+         // the state here since we know that we are not receiving anymore
+         m_receiving = FALSE;
          call CaptureSFD.captureFallingEdge();
          call PacketTimeStamp.set(m_msg, time32);
***************
*** 306,312 ****
--- 310,319 ----
          
        default:
+         /* this is the SFD for received messages */
          if ( !m_receiving && sfdHigh == FALSE ) {
            sfdHigh = TRUE;
            call CaptureSFD.captureFallingEdge();
+           // safe the SFD pin status for later use
+           sfd_state = call SFD.get();
            call CC2420Receive.sfd( time32 );
            m_receiving = TRUE;
***************
*** 316,319 ****
--- 323,328 ----
              return;
            }
+           // if SFD.get() = 0, then an other interrupt happened since we
+           // reconfigured CaptureSFD! Fall through
          }
          
***************
*** 322,326 ****
            call CaptureSFD.captureRisingEdge();
            m_receiving = FALSE;
!           if ( time - m_prev_time < 10 ) {
              call CC2420Receive.sfd_dropped();
              if (m_msg)
--- 331,343 ----
            call CaptureSFD.captureRisingEdge();
            m_receiving = FALSE;
!           /* if sfd_state is 1, then we fell through, but at the time of
!            * saving the time stamp the SFD was still high. Thus, the timestamp
!            * is valid.
!            * if the sfd_state is 0, then either we fell through and SFD
!            * was low while we safed the time stamp, or we didn't fall through.
!            * Thus, we check for the time between the two interrupts.
!            * FIXME: Why 10 tics? Seams like some magic number...
!            */
!           if ((sfd_state == 0) && (time - m_prev_time < 10) ) {
              call CC2420Receive.sfd_dropped();
              if (m_msg)



More information about the Tinyos-2-commits mailing list