[Tinyos-2-commits] CVS: tinyos-2.x/tos/chips/rf230 RF230LayerP.nc, 1.10, 1.11

Miklos Maroti mmaroti at users.sourceforge.net
Thu May 8 12:41:29 PDT 2008


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

Modified Files:
	RF230LayerP.nc 
Log Message:
fix power up lockup triggered by LPL

Index: RF230LayerP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/rf230/RF230LayerP.nc,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** RF230LayerP.nc	7 May 2008 23:24:47 -0000	1.10
--- RF230LayerP.nc	8 May 2008 19:41:27 -0000	1.11
***************
*** 157,163 ****
  	{
  		if( state == STATE_SLEEP_2_TRX_OFF )
- 		{
  			state = STATE_TRX_OFF;
- 		}
  		else if( cmd == CMD_CCA )
  		{
--- 157,161 ----
***************
*** 313,317 ****
  		else if( cmd == CMD_TURNON && state == STATE_TRX_OFF && isSpiAcquired() )
  		{
! 			ASSERT( ! radioIRQ );
  			call IRQ.captureRisingEdge();
  
--- 311,317 ----
  		else if( cmd == CMD_TURNON && state == STATE_TRX_OFF && isSpiAcquired() )
  		{
! 			ASSERT( ! radioIrq );
! 
! 			readRegister(RF230_IRQ_STATUS); // clear the interrupt register
  			call IRQ.captureRisingEdge();
  
***************
*** 322,329 ****
  			&& state == STATE_RX_ON && isSpiAcquired() )
  		{
  			call IRQ.disable();
  			radioIrq = FALSE;
  
- 			writeRegister(RF230_TRX_STATE, RF230_FORCE_TRX_OFF);
  			state = STATE_TRX_OFF;
  		}
--- 322,330 ----
  			&& state == STATE_RX_ON && isSpiAcquired() )
  		{
+ 			writeRegister(RF230_TRX_STATE, RF230_FORCE_TRX_OFF);
+ 
  			call IRQ.disable();
  			radioIrq = FALSE;
  
  			state = STATE_TRX_OFF;
  		}
***************
*** 462,470 ****
  		call SELN.set();
  
- 		length = readRegister(RF230_TRX_STATUS); 
- 
- 		// go back to RX_ON state when finished
- 		writeRegister(RF230_TRX_STATE, RF230_RX_ON);
- 
  		/*
  		 * There is a very small window (~1 microsecond) when the RF230 went 
--- 463,466 ----
***************
*** 475,489 ****
  		 * recovered.
  		 */
! 		if( (length & RF230_TRX_STATUS_MASK) != RF230_BUSY_TX )
  		{
! 			ASSERT( (length & RF230_TRX_STATUS_MASK) == RF230_PLL_ON );
  
  			call PacketTimeStamp.clear(msg);
  			return FAIL;
  		}
  
  #ifdef RF230_DEBUG_MESSAGES
  		if( call DiagMsg.record() )
  		{
  			call DiagMsg.str("tx");
  			call DiagMsg.uint16(time);
--- 471,495 ----
  		 * recovered.
  		 */
! 		if( (readRegister(RF230_TRX_STATUS) & RF230_TRX_STATUS_MASK) != RF230_BUSY_TX )
  		{
! 			ASSERT( (readRegister(RF230_TRX_STATUS) & RF230_TRX_STATUS_MASK) == RF230_PLL_ON );
! 
! 			writeRegister(RF230_TRX_STATE, RF230_RX_ON);
! 			readRegister(RF230_IRQ_STATUS);
! 			radioIrq = FALSE;
  
  			call PacketTimeStamp.clear(msg);
+ 
  			return FAIL;
  		}
  
+ 		// go back to RX_ON state when finished
+ 		writeRegister(RF230_TRX_STATE, RF230_RX_ON);
+ 
  #ifdef RF230_DEBUG_MESSAGES
  		if( call DiagMsg.record() )
  		{
+ 			length = call RF230Config.getLength(msg);
+ 
  			call DiagMsg.str("tx");
  			call DiagMsg.uint16(time);
***************
*** 587,595 ****
  		{
  			length = call RF230Config.getLength(rxMsg);
  			call DiagMsg.str("rx");
  			call DiagMsg.uint16(call PacketTimeStamp.isSet(rxMsg) ? call PacketTimeStamp.get(rxMsg) : 0);
  			call DiagMsg.uint16(call RadioAlarm.getNow());
- 			call DiagMsg.uint8(length);
  			call DiagMsg.uint8(crc != 0);
  			call DiagMsg.hex8s(call RF230Config.getPayload(rxMsg), length - 2);
  			call DiagMsg.send();
--- 593,602 ----
  		{
  			length = call RF230Config.getLength(rxMsg);
+ 
  			call DiagMsg.str("rx");
  			call DiagMsg.uint16(call PacketTimeStamp.isSet(rxMsg) ? call PacketTimeStamp.get(rxMsg) : 0);
  			call DiagMsg.uint16(call RadioAlarm.getNow());
  			call DiagMsg.uint8(crc != 0);
+ 			call DiagMsg.uint8(length);
  			call DiagMsg.hex8s(call RF230Config.getPayload(rxMsg), length - 2);
  			call DiagMsg.send();
***************
*** 632,636 ****
  #ifdef RF230_DEBUG
  			// TODO: handle this interrupt
- //			ASSERT( ! (irq & RF230_IRQ_TRX_UR) );
  			if( irq & RF230_IRQ_TRX_UR )
  			{
--- 639,642 ----
***************
*** 697,715 ****
  				}
  				else
! 				{
! #ifdef RF230_DEBUG
! 					if( call DiagMsg.record() )
! 					{
! 						call DiagMsg.str("assert irq");
! 						call DiagMsg.uint16(call RadioAlarm.getNow());
! 						call DiagMsg.hex8(readRegister(RF230_TRX_STATUS));
! 						call DiagMsg.hex8(readRegister(RF230_TRX_STATE));
! 						call DiagMsg.hex8(irq);
! 						call DiagMsg.uint8(state);
! 						call DiagMsg.uint8(cmd);
! 						call DiagMsg.send();
! 					}
! #endif
! 				}
  			}
  
--- 703,707 ----
  				}
  				else
! 					ASSERT( cmd == CMD_TURNOFF );
  			}
  
***************
*** 773,777 ****
  			if( cmd == CMD_DOWNLOAD )
  				downloadMessage();
! 			else if( cmd <= CMD_TURNON && CMD_TURNOFF <= cmd )
  				changeState();
  			else if( cmd == CMD_CHANNEL )
--- 765,769 ----
  			if( cmd == CMD_DOWNLOAD )
  				downloadMessage();
! 			else if( CMD_TURNOFF <= cmd && cmd <= CMD_TURNON )
  				changeState();
  			else if( cmd == CMD_CHANNEL )



More information about the Tinyos-2-commits mailing list