[Tinyos-2-commits] CVS: tinyos-2.x/tos/chips/rf2xx/layers ActiveMessageConfig.nc, 1.2, 1.3 ActiveMessageLayerC.nc, 1.2, 1.3 ActiveMessageLayerP.nc, 1.1, 1.2 DummyLayerC.nc, 1.2, 1.3 GenericTimeSyncMessageP.nc, 1.1, 1.2 IEEE154MessageLayer.h, 1.1, 1.2 IEEE154MessageLayer.nc, 1.1, 1.2 IEEE154MessageLayerC.nc, 1.1, 1.2 IEEE154MessageLayerP.nc, 1.1, 1.2 LowPowerListeningConfig.nc, 1.1, 1.2 LowPowerListeningDummyC.nc, 1.1, 1.2 LowPowerListeningLayerC.nc, 1.4, 1.5 LowPowerListeningLayerP.nc, 1.4, 1.5 LowpanNetworkLayerC.nc, 1.1, 1.2 MetadataFlagsLayerC.nc, 1.1, 1.2 PacketLinkLayerC.nc, 1.2, 1.3 PacketLinkLayerP.nc, 1.2, 1.3 SoftwareAckLayerC.nc, 1.2, 1.3 SoftwareAckLayerP.nc, 1.2, 1.3 TimeStampingLayerC.nc, 1.1, 1.2 TimeStampingLayerP.nc, 1.1, 1.2 IEEE154MessageConfig.nc, 1.1, NONE LowpanNetworkConfig.nc, 1.1, NONE

Miklos Maroti mmaroti at users.sourceforge.net
Mon Apr 6 19:27:46 PDT 2009


Update of /cvsroot/tinyos/tinyos-2.x/tos/chips/rf2xx/layers
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv10384/layers

Modified Files:
	ActiveMessageConfig.nc ActiveMessageLayerC.nc 
	ActiveMessageLayerP.nc DummyLayerC.nc 
	GenericTimeSyncMessageP.nc IEEE154MessageLayer.h 
	IEEE154MessageLayer.nc IEEE154MessageLayerC.nc 
	IEEE154MessageLayerP.nc LowPowerListeningConfig.nc 
	LowPowerListeningDummyC.nc LowPowerListeningLayerC.nc 
	LowPowerListeningLayerP.nc LowpanNetworkLayerC.nc 
	MetadataFlagsLayerC.nc PacketLinkLayerC.nc PacketLinkLayerP.nc 
	SoftwareAckLayerC.nc SoftwareAckLayerP.nc 
	TimeStampingLayerC.nc TimeStampingLayerP.nc 
Removed Files:
	IEEE154MessageConfig.nc LowpanNetworkConfig.nc 
Log Message:
reorganized packet header handling, added RF212Ieee154MessageC for BLIP

Index: ActiveMessageConfig.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/rf2xx/layers/ActiveMessageConfig.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** ActiveMessageConfig.nc	4 Apr 2009 00:43:55 -0000	1.2
--- ActiveMessageConfig.nc	7 Apr 2009 02:27:43 -0000	1.3
***************
*** 28,40 ****
  	/**
  	 * This command is called when the message first enters the radio stack
! 	 * via the Send.send command. This should clear the packet if the user
! 	 * forgot to do so (or return EINVAL to be strict).
! 	 */
! 	command error_t checkPacket(message_t* msg);
! 
! 	/**
! 	 * Returns a pointer to the ActiveMessage header field in the message
  	 */
! 	command activemessage_header_t* getHeader(message_t* msg);
  
  	/** Same as AMPacket.destination */
--- 28,35 ----
  	/**
  	 * This command is called when the message first enters the radio stack
! 	 * via the Send.send command. This command should return TRUE if the
! 	 * packet is deffinitely not cleared, FALSE otherwise.
  	 */
! 	command bool forgotToClear(message_t* msg);
  
  	/** Same as AMPacket.destination */

Index: ActiveMessageLayerC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/rf2xx/layers/ActiveMessageLayerC.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** ActiveMessageLayerC.nc	4 Apr 2009 00:43:55 -0000	1.2
--- ActiveMessageLayerC.nc	7 Apr 2009 02:27:43 -0000	1.3
***************
*** 22,32 ****
   */
  
- #include <ActiveMessageLayer.h>
- 
  configuration ActiveMessageLayerC
  {
  	provides
  	{
  		interface AMPacket;
  		interface AMSend[am_id_t id];
  		interface Receive[am_id_t id];
--- 22,32 ----
   */
  
  configuration ActiveMessageLayerC
  {
  	provides
  	{
+ 		interface RadioPacket;
  		interface AMPacket;
+ 		interface Packet;
  		interface AMSend[am_id_t id];
  		interface Receive[am_id_t id];
***************
*** 36,39 ****
--- 36,40 ----
  	uses
  	{
+ 		interface RadioPacket as SubPacket;
  		interface Send as SubSend;
  		interface Receive as SubReceive;
***************
*** 47,55 ****
--- 48,59 ----
  	ActiveMessageLayerP.ActiveMessageAddress -> ActiveMessageAddressC;
  
+ 	RadioPacket = ActiveMessageLayerP;
  	AMPacket = ActiveMessageLayerP;
+ 	Packet = ActiveMessageLayerP;
  	AMSend = ActiveMessageLayerP;
  	Receive = ActiveMessageLayerP.Receive;
  	Snoop = ActiveMessageLayerP.Snoop;
  	
+ 	SubPacket = ActiveMessageLayerP;
  	SubSend = ActiveMessageLayerP;
  	SubReceive = ActiveMessageLayerP;

Index: ActiveMessageLayerP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/rf2xx/layers/ActiveMessageLayerP.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ActiveMessageLayerP.nc	4 Apr 2009 00:43:55 -0000	1.1
--- ActiveMessageLayerP.nc	7 Apr 2009 02:27:43 -0000	1.2
***************
*** 22,30 ****
--- 22,34 ----
   */
  
+ #include <ActiveMessageLayer.h>
+ 
  module ActiveMessageLayerP
  {
  	provides
  	{
+ 		interface RadioPacket;
  		interface AMPacket;
+ 		interface Packet;
  		interface AMSend[am_id_t id];
  		interface Receive[am_id_t id];
***************
*** 34,37 ****
--- 38,42 ----
  	uses
  	{
+ 		interface RadioPacket as SubPacket;
  		interface Send as SubSend;
  		interface Receive as SubReceive;
***************
*** 43,55 ****
  implementation
  {
  /*----------------- Send -----------------*/
  
  	command error_t AMSend.send[am_id_t id](am_addr_t addr, message_t* msg, uint8_t len)
  	{
! 		error_t error;
! 
! 		error = call Config.checkPacket(msg);
! 		if( error != SUCCESS )
! 			return error;
  
  		call AMPacket.setSource(msg, call AMPacket.address());
--- 48,66 ----
  implementation
  {
+ 
+ 	activemessage_header_t* getHeader(message_t* msg)
+ 	{
+ 		return ((void*)msg) + call SubPacket.headerLength(msg);
+ 	}
+ 
  /*----------------- Send -----------------*/
  
  	command error_t AMSend.send[am_id_t id](am_addr_t addr, message_t* msg, uint8_t len)
  	{
! 		if( call Config.forgotToClear(msg) )
! 		{
! 			// return FAIL;
! 			call Packet.clear(msg);
! 		}
  
  		call AMPacket.setSource(msg, call AMPacket.address());
***************
*** 148,157 ****
  	inline command am_id_t AMPacket.type(message_t* msg)
  	{
! 		return (call Config.getHeader(msg))->type;
  	}
  
  	inline command void AMPacket.setType(message_t* msg, am_id_t type)
  	{
! 		(call Config.getHeader(msg))->type = type;
  	}
    
--- 159,168 ----
  	inline command am_id_t AMPacket.type(message_t* msg)
  	{
! 		return getHeader(msg)->type;
  	}
  
  	inline command void AMPacket.setType(message_t* msg, am_id_t type)
  	{
! 		getHeader(msg)->type = type;
  	}
    
***************
*** 169,171 ****
--- 180,245 ----
  	{
  	}
+ 
+ /*----------------- RadioPacket -----------------*/
+ 
+ 	async command uint8_t RadioPacket.headerLength(message_t* msg)
+ 	{
+ 		return call SubPacket.headerLength(msg) + sizeof(activemessage_header_t);
+ 	}
+ 
+ 	async command uint8_t RadioPacket.payloadLength(message_t* msg)
+ 	{
+ 		return call SubPacket.payloadLength(msg) - sizeof(activemessage_header_t);
+ 	}
+ 
+ 	async command void RadioPacket.setPayloadLength(message_t* msg, uint8_t length)
+ 	{
+ 		call SubPacket.setPayloadLength(msg, length + sizeof(activemessage_header_t));
+ 	}
+ 
+ 	async command uint8_t RadioPacket.maxPayloadLength()
+ 	{
+ 		return call SubPacket.maxPayloadLength() - sizeof(activemessage_header_t);
+ 	}
+ 
+ 	async command uint8_t RadioPacket.metadataLength(message_t* msg)
+ 	{
+ 		return call SubPacket.metadataLength(msg);
+ 	}
+ 
+ 	async command void RadioPacket.clear(message_t* msg)
+ 	{
+ 		call SubPacket.clear(msg);
+ 	}
+ 
+ 
+ /*----------------- Packet -----------------*/
+ 
+ 	command void Packet.clear(message_t* msg)
+ 	{
+ 		call RadioPacket.clear(msg);
+ 	}
+ 
+ 	command uint8_t Packet.payloadLength(message_t* msg)
+ 	{
+ 		return call RadioPacket.payloadLength(msg);
+ 	}
+ 
+ 	command void Packet.setPayloadLength(message_t* msg, uint8_t len)
+ 	{
+ 		call RadioPacket.setPayloadLength(msg, len);
+ 	}
+ 
+ 	command uint8_t Packet.maxPayloadLength()
+ 	{
+ 		return call RadioPacket.maxPayloadLength();
+ 	}
+ 
+ 	command void* Packet.getPayload(message_t* msg, uint8_t len)
+ 	{
+ 		if( len > call RadioPacket.maxPayloadLength() )
+ 			return NULL;
+ 
+ 		return ((void*)msg) + call RadioPacket.headerLength(msg);
+ 	}
  }

Index: DummyLayerC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/rf2xx/layers/DummyLayerC.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** DummyLayerC.nc	2 Apr 2009 22:09:59 -0000	1.2
--- DummyLayerC.nc	7 Apr 2009 02:27:43 -0000	1.3
***************
*** 34,37 ****
--- 34,38 ----
  		interface RadioReceive;
  		interface RadioCCA;
+ 		interface RadioPacket;
  
  		interface DummyConfig as UnconnectedConfig;
***************
*** 40,50 ****
  	uses 
  	{
  		interface RadioState as SubState;
  		interface RadioSend as SubRadioSend;
  		interface RadioReceive as SubRadioReceive;
  		interface RadioCCA as SubRadioCCA;
! 		interface SplitControl as SubControl;
! 		interface Send as SubSend;
! 		interface Receive as SubReceive;
  
  		interface DummyConfig as Config;
--- 41,53 ----
  	uses 
  	{
+ 		interface SplitControl as SubControl;
+ 		interface Send as SubSend;
+ 		interface Receive as SubReceive;
+ 
  		interface RadioState as SubState;
  		interface RadioSend as SubRadioSend;
  		interface RadioReceive as SubRadioReceive;
  		interface RadioCCA as SubRadioCCA;
! 		interface RadioPacket as SubPacket;
  
  		interface DummyConfig as Config;
***************
*** 58,61 ****
--- 61,65 ----
  	RadioReceive = SubRadioReceive;
  	RadioCCA = SubRadioCCA;
+ 	RadioPacket = SubPacket;
  
  	SplitControl = SubControl;

Index: GenericTimeSyncMessageP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/rf2xx/layers/GenericTimeSyncMessageP.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** GenericTimeSyncMessageP.nc	10 Mar 2009 20:37:58 -0000	1.1
--- GenericTimeSyncMessageP.nc	7 Apr 2009 02:27:43 -0000	1.2
***************
*** 93,97 ****
  		*(timesync_absolute_t*)(msg->data + len) = event_time;
  
! 		call PacketTimeSyncOffset.set(msg, len);
  
  		return call SubSend.send[id](addr, msg, len + sizeof(timesync_relative_t));
--- 93,97 ----
  		*(timesync_absolute_t*)(msg->data + len) = event_time;
  
! 		call PacketTimeSyncOffset.set(msg, offsetof(message_t, data) + len);
  
  		return call SubSend.send[id](addr, msg, len + sizeof(timesync_relative_t));

Index: IEEE154MessageLayer.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/rf2xx/layers/IEEE154MessageLayer.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** IEEE154MessageLayer.h	4 Apr 2009 00:43:55 -0000	1.1
--- IEEE154MessageLayer.h	7 Apr 2009 02:27:43 -0000	1.2
***************
*** 27,31 ****
  typedef nx_struct ieee154_header_t
  {
- 	nxle_uint8_t length;
  	nxle_uint16_t fcf;
  	nxle_uint8_t dsn;
--- 27,30 ----
***************
*** 35,44 ****
  } ieee154_header_t;
  
- // the actual radio driver might not use this
- typedef nx_struct ieee154_footer_t
- { 
- 	nxle_uint16_t crc;
- } ieee154_footer_t;
- 
  enum ieee154_fcf_enums {
  	IEEE154_FCF_FRAME_TYPE = 0,
--- 34,37 ----

Index: IEEE154MessageLayer.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/rf2xx/layers/IEEE154MessageLayer.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** IEEE154MessageLayer.nc	4 Apr 2009 00:43:55 -0000	1.1
--- IEEE154MessageLayer.nc	7 Apr 2009 02:27:43 -0000	1.2
***************
*** 35,48 ****
  {
  	/**
- 	 * Returns the raw value (unadjusted) of the length field
- 	 */
- 	async command uint8_t getLength(message_t* msg);
- 
- 	/**
- 	 * Sets the length field
- 	 */
- 	async command void setLength(message_t* msg, uint8_t length);
- 
- 	/**
  	 * Returns the frame control field. This method should not be used, 
  	 * isDataFrame and isAckFrame should be used instead.
--- 35,38 ----

Index: IEEE154MessageLayerC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/rf2xx/layers/IEEE154MessageLayerC.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** IEEE154MessageLayerC.nc	4 Apr 2009 00:43:55 -0000	1.1
--- IEEE154MessageLayerC.nc	7 Apr 2009 02:27:43 -0000	1.2
***************
*** 27,35 ****
  	{
  		interface IEEE154MessageLayer;
  	}
  
  	uses
  	{
! 		interface IEEE154MessageConfig as Config;
  	}
  }
--- 27,40 ----
  	{
  		interface IEEE154MessageLayer;
+ 		interface RadioPacket;
+ 		interface Ieee154Packet;
+ 		interface Packet;
+ 		interface Ieee154Send;
  	}
  
  	uses
  	{
! 		interface RadioPacket as SubPacket;
! 		interface Send as SubSend;
  	}
  }
***************
*** 41,44 ****
  
  	IEEE154MessageLayer = IEEE154MessageLayerP;
! 	Config = IEEE154MessageLayerP;
  }
--- 46,54 ----
  
  	IEEE154MessageLayer = IEEE154MessageLayerP;
! 	RadioPacket = IEEE154MessageLayerP;
! 	SubPacket = IEEE154MessageLayerP;
! 	Ieee154Packet = IEEE154MessageLayerP;
! 	Packet = IEEE154MessageLayerP;
! 	Ieee154Send = IEEE154MessageLayerP;
! 	SubSend = IEEE154MessageLayerP;
  }

Index: IEEE154MessageLayerP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/rf2xx/layers/IEEE154MessageLayerP.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** IEEE154MessageLayerP.nc	4 Apr 2009 00:43:55 -0000	1.1
--- IEEE154MessageLayerP.nc	7 Apr 2009 02:27:43 -0000	1.2
***************
*** 29,33 ****
--- 29,36 ----
  	{
  		interface IEEE154MessageLayer;
+ 		interface RadioPacket;
  		interface Ieee154Packet;
+ 		interface Packet;
+ 		interface Ieee154Send;
  	}
  
***************
*** 35,39 ****
  	{
  		interface ActiveMessageAddress;
! 		interface IEEE154MessageConfig as Config;
  	}
  }
--- 38,43 ----
  	{
  		interface ActiveMessageAddress;
! 		interface RadioPacket as SubPacket;
! 		interface Send as SubSend;
  	}
  }
***************
*** 55,59 ****
  			| (IEEE154_ADDR_SHORT << IEEE154_FCF_SRC_ADDR_MODE),
  
! 		IEEE154_ACK_FRAME_LENGTH = 5,	// includes the FCF, DSN and FCS
  		IEEE154_ACK_FRAME_MASK = (IEEE154_TYPE_MASK << IEEE154_FCF_FRAME_TYPE), 
  		IEEE154_ACK_FRAME_VALUE = (IEEE154_TYPE_ACK << IEEE154_FCF_FRAME_TYPE),
--- 59,63 ----
  			| (IEEE154_ADDR_SHORT << IEEE154_FCF_SRC_ADDR_MODE),
  
! 		IEEE154_ACK_FRAME_LENGTH = 3,	// includes the FCF, DSN
  		IEEE154_ACK_FRAME_MASK = (IEEE154_TYPE_MASK << IEEE154_FCF_FRAME_TYPE), 
  		IEEE154_ACK_FRAME_VALUE = (IEEE154_TYPE_ACK << IEEE154_FCF_FRAME_TYPE),
***************
*** 62,76 ****
  	ieee154_header_t* getHeader(message_t* msg)
  	{
! 		return call Config.getHeader(msg);
! 	}
! 
! 	async command uint8_t IEEE154MessageLayer.getLength(message_t* msg)
! 	{
! 		return getHeader(msg)->length;
! 	}
! 
! 	async command void IEEE154MessageLayer.setLength(message_t* msg, uint8_t length)
! 	{
! 		getHeader(msg)->length = length;
  	}
  
--- 66,70 ----
  	ieee154_header_t* getHeader(message_t* msg)
  	{
! 		return ((void*)msg) + call SubPacket.headerLength(msg);
  	}
  
***************
*** 102,109 ****
  	async command void IEEE154MessageLayer.createAckFrame(message_t* msg)
  	{
! 		ieee154_header_t* header = getHeader(msg);
! 
! 		header->length = IEEE154_ACK_FRAME_LENGTH;
! 		header->fcf = IEEE154_ACK_FRAME_VALUE;
  	}
  
--- 96,101 ----
  	async command void IEEE154MessageLayer.createAckFrame(message_t* msg)
  	{
! 		call SubPacket.setPayloadLength(msg, IEEE154_ACK_FRAME_LENGTH);
! 		getHeader(msg)->fcf = IEEE154_ACK_FRAME_VALUE;
  	}
  
***************
*** 111,116 ****
  	{
  		ieee154_header_t* header = getHeader(ack);
  
- 		header->length = IEEE154_ACK_FRAME_LENGTH;
  		header->fcf = IEEE154_ACK_FRAME_VALUE;
  		header->dsn = getHeader(data)->dsn;
--- 103,108 ----
  	{
  		ieee154_header_t* header = getHeader(ack);
+ 		call SubPacket.setPayloadLength(ack, IEEE154_ACK_FRAME_LENGTH);
  
  		header->fcf = IEEE154_ACK_FRAME_VALUE;
  		header->dsn = getHeader(data)->dsn;
***************
*** 256,258 ****
--- 248,353 ----
  		return call ActiveMessageAddress.amGroup();
  	}
+ 
+ /*----------------- RadioPacket -----------------*/
+ 
+ 	async command uint8_t RadioPacket.headerLength(message_t* msg)
+ 	{
+ 		return call SubPacket.headerLength(msg) + sizeof(ieee154_header_t);
+ 	}
+ 
+ 	async command uint8_t RadioPacket.payloadLength(message_t* msg)
+ 	{
+ 		return call SubPacket.payloadLength(msg) - sizeof(ieee154_header_t);
+ 	}
+ 
+ 	async command void RadioPacket.setPayloadLength(message_t* msg, uint8_t length)
+ 	{
+ 		call SubPacket.setPayloadLength(msg, length + sizeof(ieee154_header_t));
+ 	}
+ 
+ 	async command uint8_t RadioPacket.maxPayloadLength()
+ 	{
+ 		return call SubPacket.maxPayloadLength() - sizeof(ieee154_header_t);
+ 	}
+ 
+ 	async command uint8_t RadioPacket.metadataLength(message_t* msg)
+ 	{
+ 		return call SubPacket.metadataLength(msg);
+ 	}
+ 
+ 	async command void RadioPacket.clear(message_t* msg)
+ 	{
+ 		call SubPacket.clear(msg);
+ 		call IEEE154MessageLayer.createDataFrame(msg);
+ 	}
+ 
+ /*----------------- Packet -----------------*/
+ 
+ 	command void Packet.clear(message_t* msg)
+ 	{
+ 		call RadioPacket.clear(msg);
+ 	}
+ 
+ 	command uint8_t Packet.payloadLength(message_t* msg)
+ 	{
+ 		return call RadioPacket.payloadLength(msg);
+ 	}
+ 
+ 	command void Packet.setPayloadLength(message_t* msg, uint8_t len)
+ 	{
+ 		call RadioPacket.setPayloadLength(msg, len);
+ 	}
+ 
+ 	command uint8_t Packet.maxPayloadLength()
+ 	{
+ 		return call RadioPacket.maxPayloadLength();
+ 	}
+ 
+ 	command void* Packet.getPayload(message_t* msg, uint8_t len)
+ 	{
+ 		if( len > call RadioPacket.maxPayloadLength() )
+ 			return NULL;
+ 
+ 		return ((void*)msg) + call RadioPacket.headerLength(msg);
+ 	}
+ 
+ /*----------------- Ieee154Send -----------------*/
+ 
+ 	command void * Ieee154Send.getPayload(message_t* msg, uint8_t len)
+ 	{
+ 		return call Packet.getPayload(msg, len);
+ 	}
+ 
+ 	command uint8_t Ieee154Send.maxPayloadLength()
+ 	{
+ 		return call Packet.maxPayloadLength();
+ 	}
+ 
+ 	command error_t Ieee154Send.cancel(message_t* msg)
+ 	{
+ 		return call SubSend.cancel(msg);
+ 	}
+ 
+ 	command error_t Ieee154Send.send(ieee154_saddr_t addr, message_t* msg, uint8_t len)
+ 	{
+ 		ieee154_header_t* header = getHeader(msg);
+ 
+ 		header->dest = addr;
+ 	    	header->destpan = call Ieee154Packet.localPan();
+ 	    	header->src = call Ieee154Packet.address();
+ 		
+ 		// Notifier (in original ActiveMessage) --> Not used in CC2420
+ 	    	// signal SendNotifier.aboutToSend(addr, msg);
+     	
+     		return call SubSend.send(msg, len);
+ 	}
+ 
+ 	event void SubSend.sendDone(message_t* msg, error_t error)
+ 	{
+ 		signal Ieee154Send.sendDone(msg, error);
+ 	}
+ 
+ 	default event void Ieee154Send.sendDone(message_t* msg, error_t error)
+ 	{
+ 	}
  }

Index: LowPowerListeningConfig.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/rf2xx/layers/LowPowerListeningConfig.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** LowPowerListeningConfig.nc	4 Apr 2009 00:43:55 -0000	1.1
--- LowPowerListeningConfig.nc	7 Apr 2009 02:27:43 -0000	1.2
***************
*** 22,42 ****
   */
  
- #include <LowPowerListeningLayer.h>
- 
  interface LowPowerListeningConfig
  {
  	/**
- 	 * Returns a pointer to the low power listening metadata fields in 
- 	 * the message
- 	 */
- 	async command lpl_metadata_t* metadata(message_t* msg);
- 
- 	/**
- 	 * Clears the low power listening metadata fields in order to disable 
- 	 * low power listening for the message
- 	 */
- 	async event void clear(message_t* msg);
- 
- 	/**
  	 * Returns TRUE if an acknowledgement is requested for this message.
  	 */
--- 22,28 ----

Index: LowPowerListeningDummyC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/rf2xx/layers/LowPowerListeningDummyC.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** LowPowerListeningDummyC.nc	2 Apr 2009 22:10:03 -0000	1.1
--- LowPowerListeningDummyC.nc	7 Apr 2009 02:27:43 -0000	1.2
***************
*** 29,32 ****
--- 29,33 ----
  		interface Send;
  		interface Receive;
+ 		interface RadioPacket;
  
  		interface LowPowerListening;
***************
*** 37,40 ****
--- 38,42 ----
  		interface Send as SubSend;
  		interface Receive as SubReceive;
+ 		interface RadioPacket as SubPacket;
  	}
  }
***************
*** 45,48 ****
--- 47,51 ----
  	Send = SubSend;
  	Receive = SubReceive;
+ 	RadioPacket = SubPacket;
  
  	components LowPowerListeningDummyP;

Index: LowPowerListeningLayerC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/rf2xx/layers/LowPowerListeningLayerC.nc,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** LowPowerListeningLayerC.nc	4 Apr 2009 00:43:55 -0000	1.4
--- LowPowerListeningLayerC.nc	7 Apr 2009 02:27:43 -0000	1.5
***************
*** 22,27 ****
   */
  
- #include <LowPowerListeningLayer.h>
- 
  #warning "*** USING LOW POWER LISTENING LAYER"
  
--- 22,25 ----
***************
*** 33,36 ****
--- 31,35 ----
  		interface Send;
  		interface Receive;
+ 		interface RadioPacket;
  
  		interface LowPowerListening;
***************
*** 41,44 ****
--- 40,44 ----
  		interface Send as SubSend;
  		interface Receive as SubReceive;
+ 		interface RadioPacket as SubPacket;
  
  		interface LowPowerListeningConfig as Config;
***************
*** 54,57 ****
--- 54,58 ----
  	Send = LowPowerListeningLayerP;
  	Receive = LowPowerListeningLayerP;
+ 	RadioPacket = LowPowerListeningLayerP;
  	LowPowerListening = LowPowerListeningLayerP;
  
***************
*** 59,62 ****
--- 60,64 ----
  	SubSend = LowPowerListeningLayerP;
  	SubReceive = LowPowerListeningLayerP;
+ 	SubPacket = LowPowerListeningLayerP;
  	Config = LowPowerListeningLayerP;
  	PacketAcknowledgements = LowPowerListeningLayerP;

Index: LowPowerListeningLayerP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/rf2xx/layers/LowPowerListeningLayerP.nc,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** LowPowerListeningLayerP.nc	4 Apr 2009 00:43:55 -0000	1.4
--- LowPowerListeningLayerP.nc	7 Apr 2009 02:27:43 -0000	1.5
***************
*** 32,35 ****
--- 32,36 ----
  		interface Send;
  		interface Receive;
+ 		interface RadioPacket;
  
  		interface LowPowerListening;
***************
*** 41,44 ****
--- 42,46 ----
  		interface Send as SubSend;
  		interface Receive as SubReceive;
+ 		interface RadioPacket as SubPacket;
  
  		interface PacketAcknowledgements;
***************
*** 359,362 ****
--- 361,369 ----
  /*----------------- LowPowerListening -----------------*/
  
+ 	lpl_metadata_t* getMeta(message_t* msg)
+ 	{
+ 		return ((void*)msg) + sizeof(message_t) - call RadioPacket.metadataLength(msg);
+ 	}
+ 
  	command uint16_t LowPowerListening.dutyCycleToSleepInterval(uint16_t dutyCycle)
  	{
***************
*** 419,428 ****
  			interval = MAX_SLEEP;
  
! 		(call Config.metadata(msg))->sleepint = interval;
  	}
  
  	command uint16_t LowPowerListening.getRxSleepInterval(message_t *msg)
  	{
! 		uint16_t sleepint = (call Config.metadata(msg))->sleepint;
  
  		return sleepint != 0 ? sleepint : sleepInterval;
--- 426,435 ----
  			interval = MAX_SLEEP;
  
! 		getMeta(msg)->sleepint = interval;
  	}
  
  	command uint16_t LowPowerListening.getRxSleepInterval(message_t *msg)
  	{
! 		uint16_t sleepint = getMeta(msg)->sleepint;
  
  		return sleepint != 0 ? sleepint : sleepInterval;
***************
*** 441,447 ****
  	}
  
! 	async event void Config.clear(message_t* msg)
  	{
! 		(call Config.metadata(msg))->sleepint = 0;
  	}
  }
--- 448,482 ----
  	}
  
! /*----------------- RadioPacket -----------------*/
! 	
! 	async command uint8_t RadioPacket.headerLength(message_t* msg)
  	{
! 		return call SubPacket.headerLength(msg);
! 	}
! 
! 	async command uint8_t RadioPacket.payloadLength(message_t* msg)
! 	{
! 		return call SubPacket.payloadLength(msg);
! 	}
! 
! 	async command void RadioPacket.setPayloadLength(message_t* msg, uint8_t length)
! 	{
! 		call SubPacket.setPayloadLength(msg, length);
! 	}
! 
! 	async command uint8_t RadioPacket.maxPayloadLength()
! 	{
! 		return call SubPacket.maxPayloadLength();
! 	}
! 
! 	async command uint8_t RadioPacket.metadataLength(message_t* msg)
! 	{
! 		return call SubPacket.metadataLength(msg) + sizeof(lpl_metadata_t);
! 	}
! 
! 	async command void RadioPacket.clear(message_t* msg)
! 	{
! 		getMeta(msg)->sleepint = 0;
! 		call SubPacket.clear(msg);
  	}
  }

Index: LowpanNetworkLayerC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/rf2xx/layers/LowpanNetworkLayerC.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** LowpanNetworkLayerC.nc	4 Apr 2009 00:43:55 -0000	1.1
--- LowpanNetworkLayerC.nc	7 Apr 2009 02:27:43 -0000	1.2
***************
*** 22,25 ****
--- 22,27 ----
   */
  
+ #include <LowpanNetworkLayer.h>
+ 
  module LowpanNetworkLayerC
  {
***************
*** 28,31 ****
--- 30,34 ----
  		interface Send;
  		interface Receive;
+ 		interface RadioPacket;
  
  		interface Receive as NonTinyosReceive[uint8_t network];
***************
*** 36,40 ****
  		interface Send as SubSend;
  		interface Receive as SubReceive;
! 		interface LowpanNetworkConfig as Config;
  	}
  }
--- 39,43 ----
  		interface Send as SubSend;
  		interface Receive as SubReceive;
! 		interface RadioPacket as SubPacket;
  	}
  }
***************
*** 46,52 ****
  #endif
  
  	command error_t Send.send(message_t* msg, uint8_t len)
  	{
! 		(call Config.getHeader(msg))->network = TINYOS_6LOWPAN_NETWORK_ID;
  		return call SubSend.send(msg, len);
  	}
--- 49,60 ----
  #endif
  
+ 	lowpan_header_t* getHeader(message_t* msg)
+ 	{
+ 		return ((void*)msg) + call SubPacket.headerLength(msg);
+ 	}
+ 
  	command error_t Send.send(message_t* msg, uint8_t len)
  	{
! 		getHeader(msg)->network = TINYOS_6LOWPAN_NETWORK_ID;
  		return call SubSend.send(msg, len);
  	}
***************
*** 74,78 ****
  	event message_t *SubReceive.receive(message_t *msg, void *payload, uint8_t len)
  	{
! 		uint8_t network = (call Config.getHeader(msg))->network;
  		if( network == TINYOS_6LOWPAN_NETWORK_ID )
  			return signal Receive.receive(msg, payload, len);
--- 82,86 ----
  	event message_t *SubReceive.receive(message_t *msg, void *payload, uint8_t len)
  	{
! 		uint8_t network = getHeader(msg)->network;
  		if( network == TINYOS_6LOWPAN_NETWORK_ID )
  			return signal Receive.receive(msg, payload, len);
***************
*** 85,87 ****
--- 93,127 ----
  		return msg;
  	}
+ 
+ /*----------------- RadioPacket -----------------*/
+ 
+ 	async command uint8_t RadioPacket.headerLength(message_t* msg)
+ 	{
+ 		return call SubPacket.headerLength(msg) + sizeof(lowpan_header_t);
+ 	}
+ 
+ 	async command uint8_t RadioPacket.payloadLength(message_t* msg)
+ 	{
+ 		return call SubPacket.payloadLength(msg) - sizeof(lowpan_header_t);
+ 	}
+ 
+ 	async command void RadioPacket.setPayloadLength(message_t* msg, uint8_t length)
+ 	{
+ 		call SubPacket.setPayloadLength(msg, length + sizeof(lowpan_header_t));
+ 	}
+ 
+ 	async command uint8_t RadioPacket.maxPayloadLength()
+ 	{
+ 		return call SubPacket.maxPayloadLength() - sizeof(lowpan_header_t);
+ 	}
+ 
+ 	async command uint8_t RadioPacket.metadataLength(message_t* msg)
+ 	{
+ 		return call SubPacket.metadataLength(msg);
+ 	}
+ 
+ 	async command void RadioPacket.clear(message_t* msg)
+ 	{
+ 		call SubPacket.clear(msg);
+ 	}
  }

Index: MetadataFlagsLayerC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/rf2xx/layers/MetadataFlagsLayerC.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** MetadataFlagsLayerC.nc	2 Apr 2009 22:10:04 -0000	1.1
--- MetadataFlagsLayerC.nc	7 Apr 2009 02:27:43 -0000	1.2
***************
*** 30,38 ****
  	{
  		interface PacketFlag[uint8_t bit];
  	}
  
  	uses
  	{
! 		interface PacketData<flags_metadata_t> as PacketFlagsMetadata;
  	}
  }
--- 30,39 ----
  	{
  		interface PacketFlag[uint8_t bit];
+ 		interface RadioPacket;
  	}
  
  	uses
  	{
! 		interface RadioPacket as SubPacket;
  	}
  }
***************
*** 40,46 ****
  implementation
  {
  	async command bool PacketFlag.get[uint8_t bit](message_t* msg)
  	{
! 		return (call PacketFlagsMetadata.get(msg))->flags & (1<<bit);
  	}
  
--- 41,54 ----
  implementation
  {
+ 	flags_metadata_t* getMeta(message_t* msg)
+ 	{
+ 		return ((void*)msg) + sizeof(message_t) - call RadioPacket.metadataLength(msg);
+ 	}
+ 
+ /*----------------- RadioPacket -----------------*/
+ 
  	async command bool PacketFlag.get[uint8_t bit](message_t* msg)
  	{
! 		return getMeta(msg)->flags & (1<<bit);
  	}
  
***************
*** 49,53 ****
  		ASSERT( bit  < 8 );
  
! 		(call PacketFlagsMetadata.get(msg))->flags |= (1<<bit);
  	}
  
--- 57,61 ----
  		ASSERT( bit  < 8 );
  
! 		getMeta(msg)->flags |= (1<<bit);
  	}
  
***************
*** 56,60 ****
  		ASSERT( bit  < 8 );
  
! 		(call PacketFlagsMetadata.get(msg))->flags &= ~(1<<bit);
  	}
  
--- 64,68 ----
  		ASSERT( bit  < 8 );
  
! 		getMeta(msg)->flags &= ~(1<<bit);
  	}
  
***************
*** 67,73 ****
  	}
  
! 	async event void PacketFlagsMetadata.clear(message_t* msg)
  	{
! 		(call PacketFlagsMetadata.get(msg))->flags = 0;
  	}
  }
--- 75,109 ----
  	}
  
! /*----------------- RadioPacket -----------------*/
! 	
! 	async command uint8_t RadioPacket.headerLength(message_t* msg)
  	{
! 		return call SubPacket.headerLength(msg);
! 	}
! 
! 	async command uint8_t RadioPacket.payloadLength(message_t* msg)
! 	{
! 		return call SubPacket.payloadLength(msg);
! 	}
! 
! 	async command void RadioPacket.setPayloadLength(message_t* msg, uint8_t length)
! 	{
! 		call SubPacket.setPayloadLength(msg, length);
! 	}
! 
! 	async command uint8_t RadioPacket.maxPayloadLength()
! 	{
! 		return call SubPacket.maxPayloadLength();
! 	}
! 
! 	async command uint8_t RadioPacket.metadataLength(message_t* msg)
! 	{
! 		return call SubPacket.metadataLength(msg) + sizeof(flags_metadata_t);
! 	}
! 
! 	async command void RadioPacket.clear(message_t* msg)
! 	{
! 		getMeta(msg)->flags = 0;
! 		call SubPacket.clear(msg);
  	}
  }

Index: PacketLinkLayerC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/rf2xx/layers/PacketLinkLayerC.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** PacketLinkLayerC.nc	2 Apr 2009 22:10:04 -0000	1.2
--- PacketLinkLayerC.nc	7 Apr 2009 02:27:43 -0000	1.3
***************
*** 66,74 ****
      interface Send;
      interface PacketLink;
    }
    
    uses {
      interface Send as SubSend;
!     interface PacketData<link_metadata_t> as PacketLinkMetadata;
      interface PacketAcknowledgements;
    }
--- 66,75 ----
      interface Send;
      interface PacketLink;
+     interface RadioPacket;
    }
    
    uses {
      interface Send as SubSend;
!     interface RadioPacket as SubPacket;
      interface PacketAcknowledgements;
    }
***************
*** 79,86 ****
    
    PacketLink = PacketLinkLayerP;
!   Send = PacketLinkLayerP.Send;
!   SubSend = PacketLinkLayerP.SubSend;
    PacketAcknowledgements = PacketLinkLayerP;
!   PacketLinkMetadata = PacketLinkLayerP;
  
    PacketLinkLayerP.DelayTimer -> DelayTimerC;
--- 80,88 ----
    
    PacketLink = PacketLinkLayerP;
!   Send = PacketLinkLayerP;
!   SubSend = PacketLinkLayerP;
    PacketAcknowledgements = PacketLinkLayerP;
!   RadioPacket = PacketLinkLayerP;
!   SubPacket = PacketLinkLayerP;
  
    PacketLinkLayerP.DelayTimer -> DelayTimerC;

Index: PacketLinkLayerP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/rf2xx/layers/PacketLinkLayerP.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** PacketLinkLayerP.nc	2 Apr 2009 22:10:04 -0000	1.2
--- PacketLinkLayerP.nc	7 Apr 2009 02:27:43 -0000	1.3
***************
*** 64,67 ****
--- 64,68 ----
      interface Send;
      interface PacketLink;
+     interface RadioPacket;
    }
  
***************
*** 70,74 ****
      interface PacketAcknowledgements;
      interface Timer<TMilli> as DelayTimer;
!     interface PacketData<link_metadata_t> as PacketLinkMetadata;
    }
  }
--- 71,75 ----
      interface PacketAcknowledgements;
      interface Timer<TMilli> as DelayTimer;
!     interface RadioPacket as SubPacket;
    }
  }
***************
*** 92,95 ****
--- 93,101 ----
  
    /***************** PacketLink Commands ***************/
+ 
+   link_metadata_t* getMeta(message_t* msg) {
+     return ((void*)msg) + sizeof(message_t) - call RadioPacket.metadataLength(msg);
+   }
+ 
    /**
     * Set the maximum number of times attempt message delivery
***************
*** 100,104 ****
     */
    command void PacketLink.setRetries(message_t *msg, uint16_t maxRetries) {
!     (call PacketLinkMetadata.get(msg))->maxRetries = maxRetries;
    }
  
--- 106,110 ----
     */
    command void PacketLink.setRetries(message_t *msg, uint16_t maxRetries) {
!     getMeta(msg)->maxRetries = maxRetries;
    }
  
***************
*** 109,113 ****
     */
    command void PacketLink.setRetryDelay(message_t *msg, uint16_t retryDelay) {
!     (call PacketLinkMetadata.get(msg))->retryDelay = retryDelay;
    }
  
--- 115,119 ----
     */
    command void PacketLink.setRetryDelay(message_t *msg, uint16_t retryDelay) {
!     getMeta(msg)->retryDelay = retryDelay;
    }
  
***************
*** 116,120 ****
     */
    command uint16_t PacketLink.getRetries(message_t *msg) {
!     return (call PacketLinkMetadata.get(msg))->maxRetries;
    }
  
--- 122,126 ----
     */
    command uint16_t PacketLink.getRetries(message_t *msg) {
!     return getMeta(msg)->maxRetries;
    }
  
***************
*** 123,127 ****
     */
    command uint16_t PacketLink.getRetryDelay(message_t *msg) {
!     return (call PacketLinkMetadata.get(msg))->retryDelay;
    }
  
--- 129,133 ----
     */
    command uint16_t PacketLink.getRetryDelay(message_t *msg) {
!     return getMeta(msg)->retryDelay;
    }
  
***************
*** 133,140 ****
    }
  
-   async event void PacketLinkMetadata.clear(message_t* msg) {
-     (call PacketLinkMetadata.get(msg))->maxRetries = 0;
-   }
- 
    /***************** Send Commands ***************/
    /**
--- 139,142 ----
***************
*** 238,240 ****
--- 240,268 ----
      signal Send.sendDone(msg, error);
    }
+ 
+   /***************** Functions ***************/
+   async command uint8_t RadioPacket.headerLength(message_t* msg) {
+     return call SubPacket.headerLength(msg);
+   }
+ 
+   async command uint8_t RadioPacket.payloadLength(message_t* msg) {
+     return call SubPacket.payloadLength(msg);
+   }
+ 
+   async command void RadioPacket.setPayloadLength(message_t* msg, uint8_t length) {
+     call SubPacket.setPayloadLength(msg, length);
+   }
+ 
+   async command uint8_t RadioPacket.maxPayloadLength() {
+     return call SubPacket.maxPayloadLength();
+   }
+ 
+   async command uint8_t RadioPacket.metadataLength(message_t* msg) {
+     return call SubPacket.metadataLength(msg) + sizeof(link_metadata_t);
+   }
+ 
+   async command void RadioPacket.clear(message_t* msg) {
+     getMeta(msg)->maxRetries = 0;
+     call SubPacket.clear(msg);
+   }
  }

Index: SoftwareAckLayerC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/rf2xx/layers/SoftwareAckLayerC.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** SoftwareAckLayerC.nc	2 Apr 2009 22:10:04 -0000	1.2
--- SoftwareAckLayerC.nc	7 Apr 2009 02:27:43 -0000	1.3
***************
*** 28,33 ****
--- 28,35 ----
  		interface RadioSend;
  		interface RadioReceive;
+ 
  		interface PacketAcknowledgements;
  	}
+ 
  	uses
  	{

Index: SoftwareAckLayerP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/rf2xx/layers/SoftwareAckLayerP.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** SoftwareAckLayerP.nc	2 Apr 2009 22:10:04 -0000	1.2
--- SoftwareAckLayerP.nc	7 Apr 2009 02:27:43 -0000	1.3
***************
*** 33,36 ****
--- 33,37 ----
  		interface PacketAcknowledgements;
  	}
+ 
  	uses
  	{

Index: TimeStampingLayerC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/rf2xx/layers/TimeStampingLayerC.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** TimeStampingLayerC.nc	2 Apr 2009 22:10:05 -0000	1.1
--- TimeStampingLayerC.nc	7 Apr 2009 02:27:43 -0000	1.2
***************
*** 28,31 ****
--- 28,32 ----
  		interface PacketTimeStamp<TMilli, uint32_t> as PacketTimeStampMilli;
  		interface PacketTimeStamp<TRadio, uint32_t> as PacketTimeStampRadio;
+ 		interface RadioPacket;
  	}
  
***************
*** 33,37 ****
  	{
  		interface LocalTime<TRadio> as LocalTimeRadio;
! 		interface PacketData<timestamp_metadata_t> as PacketTimeStampMetadata;
  	}
  }
--- 34,38 ----
  	{
  		interface LocalTime<TRadio> as LocalTimeRadio;
! 		interface RadioPacket as SubPacket;
  	}
  }
***************
*** 43,47 ****
  	PacketTimeStampMilli = TimeStampingLayerP;
  	PacketTimeStampRadio = TimeStampingLayerP;
! 	PacketTimeStampMetadata = TimeStampingLayerP.PacketTimeStampMetadata;
  
  	LocalTimeRadio = TimeStampingLayerP;
--- 44,49 ----
  	PacketTimeStampMilli = TimeStampingLayerP;
  	PacketTimeStampRadio = TimeStampingLayerP;
! 	RadioPacket = TimeStampingLayerP.RadioPacket;
! 	SubPacket = TimeStampingLayerP.SubPacket;
  
  	LocalTimeRadio = TimeStampingLayerP;

Index: TimeStampingLayerP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/rf2xx/layers/TimeStampingLayerP.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** TimeStampingLayerP.nc	2 Apr 2009 22:10:05 -0000	1.1
--- TimeStampingLayerP.nc	7 Apr 2009 02:27:43 -0000	1.2
***************
*** 31,34 ****
--- 31,35 ----
  		interface PacketTimeStamp<TMilli, uint32_t> as PacketTimeStampMilli;
  		interface PacketTimeStamp<TRadio, uint32_t> as PacketTimeStampRadio;
+ 		interface RadioPacket;
  	}
  
***************
*** 40,44 ****
  		interface LocalTime<TMilli> as LocalTimeMilli;
  
! 		interface PacketData<timestamp_metadata_t> as PacketTimeStampMetadata;
  	}
  }
--- 41,45 ----
  		interface LocalTime<TMilli> as LocalTimeMilli;
  
! 		interface RadioPacket as SubPacket;
  	}
  }
***************
*** 46,49 ****
--- 47,57 ----
  implementation
  {
+ 	timestamp_metadata_t* getMeta(message_t* msg)
+ 	{
+ 		return ((void*)msg) + sizeof(message_t) - call RadioPacket.metadataLength(msg);
+ 	}
+ 
+ /*----------------- PacketTimeStampRadio -----------------*/
+ 	
  	async command bool PacketTimeStampRadio.isValid(message_t* msg)
  	{
***************
*** 53,57 ****
  	async command uint32_t PacketTimeStampRadio.timestamp(message_t* msg)
  	{
! 		return (call PacketTimeStampMetadata.get(msg))->timestamp;
  	}
  
--- 61,65 ----
  	async command uint32_t PacketTimeStampRadio.timestamp(message_t* msg)
  	{
! 		return getMeta(msg)->timestamp;
  	}
  
***************
*** 64,73 ****
  	{
  		call TimeStampFlag.set(msg);
! 		(call PacketTimeStampMetadata.get(msg))->timestamp = value;
  	}
  
! 	async event void PacketTimeStampMetadata.clear(message_t* msg)
! 	{
! 	}
  
  	async command bool PacketTimeStampMilli.isValid(message_t* msg)
--- 72,79 ----
  	{
  		call TimeStampFlag.set(msg);
! 		getMeta(msg)->timestamp = value;
  	}
  
! /*----------------- PacketTimeStampMilli -----------------*/
  
  	async command bool PacketTimeStampMilli.isValid(message_t* msg)
***************
*** 94,96 ****
--- 100,135 ----
  		call PacketTimeStampRadio.set(msg, offset + call LocalTimeRadio.get());
  	}
+ 
+ /*----------------- RadioPacket -----------------*/
+ 	
+ 	async command uint8_t RadioPacket.headerLength(message_t* msg)
+ 	{
+ 		return call SubPacket.headerLength(msg);
+ 	}
+ 
+ 	async command uint8_t RadioPacket.payloadLength(message_t* msg)
+ 	{
+ 		return call SubPacket.payloadLength(msg);
+ 	}
+ 
+ 	async command void RadioPacket.setPayloadLength(message_t* msg, uint8_t length)
+ 	{
+ 		call SubPacket.setPayloadLength(msg, length);
+ 	}
+ 
+ 	async command uint8_t RadioPacket.maxPayloadLength()
+ 	{
+ 		return call SubPacket.maxPayloadLength();
+ 	}
+ 
+ 	async command uint8_t RadioPacket.metadataLength(message_t* msg)
+ 	{
+ 		return call SubPacket.metadataLength(msg) + sizeof(timestamp_metadata_t);
+ 	}
+ 
+ 	async command void RadioPacket.clear(message_t* msg)
+ 	{
+ 		// all flags are automatically cleared
+ 		call SubPacket.clear(msg);
+ 	}
  }

--- IEEE154MessageConfig.nc DELETED ---

--- LowpanNetworkConfig.nc DELETED ---



More information about the Tinyos-2-commits mailing list