[Tinyos-commits] CVS: tinyos-1.x/tos/lib/CC2420Radio CC2420RadioM.nc, 1.38, 1.39

Joe Polastre jpolastre at users.sourceforge.net
Wed Jul 13 11:57:34 PDT 2005


Update of /cvsroot/tinyos/tinyos-1.x/tos/lib/CC2420Radio
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21927

Modified Files:
	CC2420RadioM.nc 
Log Message:
bug fix from Matt Welsh for race condition in CC2420 radio stack:

If ACK comes in before PacketSent() runs, the PacketSent() task can be posted twice (duplicate sendDone events). Fix: set the state to a different value to suppress the later task.


Index: CC2420RadioM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/tos/lib/CC2420Radio/CC2420RadioM.nc,v
retrieving revision 1.38
retrieving revision 1.39
diff -C2 -d -r1.38 -r1.39
*** CC2420RadioM.nc	20 Oct 2004 05:14:12 -0000	1.38
--- CC2420RadioM.nc	13 Jul 2005 18:57:32 -0000	1.39
***************
*** 423,427 ****
      case TIMER_ACK:
        if (currentstate == POST_TX_STATE) {
!         txbufptr->ack = 0;
          if (!post PacketSent())
  	  sendFailed();
--- 423,435 ----
      case TIMER_ACK:
        if (currentstate == POST_TX_STATE) {
! 	/* MDW 12-July-05: Race condition here: If ACK comes in before
! 	 * PacketSent() runs, the task can be posted twice (duplicate
! 	 * sendDone events). Fix: set the state to a different value to
! 	 * suppress the later task.
! 	 */
! 	atomic {
! 	  txbufptr->ack = 0;
! 	  stateRadio = POST_TX_ACK_STATE;
! 	}
          if (!post PacketSent())
  	  sendFailed();
***************
*** 610,614 ****
          txbufptr->strength = data[length-2];
          txbufptr->lqi = data[length-1] & 0x7F;
!         currentstate = POST_TX_ACK_STATE;
          bPacketReceiving = FALSE;
        }
--- 618,623 ----
          txbufptr->strength = data[length-2];
          txbufptr->lqi = data[length-1] & 0x7F;
! 	/* MDW 12-Jul-05: Need to set the real radio state here... */
!         stateRadio = POST_TX_ACK_STATE;
          bPacketReceiving = FALSE;
        }



More information about the Tinyos-commits mailing list