[Tinyos-2-commits] CVS: tinyos-2.x/tos/chips/rf2xx/rf212 RF212ActiveMessage.h, 1.1, 1.2 RF212ActiveMessageC.nc, 1.4, 1.5 RF212ActiveMessageP.nc, 1.4, 1.5

Miklos Maroti mmaroti at users.sourceforge.net
Fri Apr 3 17:43:57 PDT 2009


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

Modified Files:
	RF212ActiveMessage.h RF212ActiveMessageC.nc 
	RF212ActiveMessageP.nc 
Log Message:
reorganized packet header handling

Index: RF212ActiveMessage.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/rf2xx/rf212/RF212ActiveMessage.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** RF212ActiveMessage.h	2 Apr 2009 22:10:07 -0000	1.1
--- RF212ActiveMessage.h	4 Apr 2009 00:43:55 -0000	1.2
***************
*** 25,29 ****
  #define __RF212ACTIVEMESSAGE_H__
  
! #include <IEEE154PacketLayer.h>
  #include <MetadataFlagsLayer.h>
  #include <RF212DriverLayer.h>
--- 25,31 ----
  #define __RF212ACTIVEMESSAGE_H__
  
! #include <IEEE154MessageLayer.h>
! #include <LowpanNetworkLayer.h>
! #include <ActiveMessageLayer.h>
  #include <MetadataFlagsLayer.h>
  #include <RF212DriverLayer.h>
***************
*** 32,36 ****
  #include <PacketLinkLayer.h>
  
! typedef ieee154_header_t rf212packet_header_t;
  
  typedef nx_struct rf212packet_footer_t
--- 34,45 ----
  #include <PacketLinkLayer.h>
  
! typedef nx_struct rf212packet_header_t
! {
! 	ieee154_header_t ieee154;
! #ifndef TFRAMES_ENABLED
! 	lowpan_header_t lowpan;
! #endif
! 	activemessage_header_t am;
! } rf212packet_header_t;
  
  typedef nx_struct rf212packet_footer_t

Index: RF212ActiveMessageC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/rf2xx/rf212/RF212ActiveMessageC.nc,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** RF212ActiveMessageC.nc	2 Apr 2009 22:10:07 -0000	1.4
--- RF212ActiveMessageC.nc	4 Apr 2009 00:43:55 -0000	1.5
***************
*** 57,61 ****
  implementation
  {
! 	components RF212ActiveMessageP, IEEE154PacketLayerC, RadioAlarmC;
  
  #ifdef RADIO_DEBUG
--- 57,61 ----
  implementation
  {
! 	components RF212ActiveMessageP, RadioAlarmC;
  
  #ifdef RADIO_DEBUG
***************
*** 63,93 ****
  #endif
  
! 	RF212ActiveMessageP.IEEE154PacketLayer -> IEEE154PacketLayerC;
  	RF212ActiveMessageP.RadioAlarm -> RadioAlarmC.RadioAlarm[unique("RadioAlarm")];
  	RF212ActiveMessageP.PacketTimeStamp -> TimeStampingLayerC;
- 
  	Packet = RF212ActiveMessageP;
  
! // -------- ActiveMessage
  
  	components ActiveMessageLayerC;
  	ActiveMessageLayerC.Config -> RF212ActiveMessageP;
! 	ActiveMessageLayerC.AMPacket -> IEEE154PacketLayerC;
! 	ActiveMessageLayerC.SubSend -> IEEE154NetworkLayerC;
! 	ActiveMessageLayerC.SubReceive -> IEEE154NetworkLayerC;
  	AMSend = ActiveMessageLayerC;
  	Receive = ActiveMessageLayerC.Receive;
  	Snoop = ActiveMessageLayerC.Snoop;
! 	AMPacket = IEEE154PacketLayerC;
  
! // -------- IEEE154Network
  
  #ifdef TFRAMES_ENABLED
! 	components new DummyLayerC() as IEEE154NetworkLayerC;
  #else
! 	components IEEE154NetworkLayerC;
  #endif
! 	IEEE154NetworkLayerC.SubSend -> UniqueLayerC;
! 	IEEE154NetworkLayerC.SubReceive -> LowPowerListeningLayerC;
  
  // -------- UniqueLayer Send part (wired twice)
--- 63,97 ----
  #endif
  
! 	RF212ActiveMessageP.IEEE154MessageLayer -> IEEE154MessageLayerC;
  	RF212ActiveMessageP.RadioAlarm -> RadioAlarmC.RadioAlarm[unique("RadioAlarm")];
  	RF212ActiveMessageP.PacketTimeStamp -> TimeStampingLayerC;
  	Packet = RF212ActiveMessageP;
  
! // -------- Active Message
  
  	components ActiveMessageLayerC;
  	ActiveMessageLayerC.Config -> RF212ActiveMessageP;
! 	ActiveMessageLayerC.SubSend -> LowpanNetworkLayerC;
! 	ActiveMessageLayerC.SubReceive -> LowpanNetworkLayerC;
  	AMSend = ActiveMessageLayerC;
  	Receive = ActiveMessageLayerC.Receive;
  	Snoop = ActiveMessageLayerC.Snoop;
! 	AMPacket = ActiveMessageLayerC;
  
! // -------- Lowpan Network
  
  #ifdef TFRAMES_ENABLED
! 	components new DummyLayerC() as LowpanNetworkLayerC;
  #else
! 	components LowpanNetworkLayerC;
! 	LowpanNetworkLayerC.Config -> RF212ActiveMessageP;
  #endif
! 	LowpanNetworkLayerC.SubSend -> UniqueLayerC;
! 	LowpanNetworkLayerC.SubReceive -> LowPowerListeningLayerC;
! 
! // -------- IEEE154 Packet
! 
! 	components IEEE154MessageLayerC;
! 	IEEE154MessageLayerC.Config -> RF212ActiveMessageP;
  
  // -------- UniqueLayer Send part (wired twice)
***************
*** 101,106 ****
  #ifdef LOW_POWER_LISTENING
  	components LowPowerListeningLayerC;
! 	LowPowerListeningLayerC.PacketLplMetadata -> RF212ActiveMessageP;
! 	LowPowerListeningLayerC.IEEE154PacketLayer -> IEEE154PacketLayerC;
  	LowPowerListeningLayerC.PacketAcknowledgements -> SoftwareAckLayerC;
  #else	
--- 105,109 ----
  #ifdef LOW_POWER_LISTENING
  	components LowPowerListeningLayerC;
! 	LowPowerListeningLayerC.Config -> RF212ActiveMessageP;
  	LowPowerListeningLayerC.PacketAcknowledgements -> SoftwareAckLayerC;
  #else	

Index: RF212ActiveMessageP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/rf2xx/rf212/RF212ActiveMessageP.nc,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** RF212ActiveMessageP.nc	2 Apr 2009 22:10:07 -0000	1.4
--- RF212ActiveMessageP.nc	4 Apr 2009 00:43:55 -0000	1.5
***************
*** 38,41 ****
--- 38,43 ----
  		interface SlottedCollisionConfig;
  		interface ActiveMessageConfig;
+ 		interface LowpanNetworkConfig;
+ 		interface IEEE154MessageConfig;
  		interface DummyConfig;
  
***************
*** 47,51 ****
  
  #ifdef LOW_POWER_LISTENING
! 		interface PacketData<lpl_metadata_t> as PacketLplMetadata;
  #endif
  #ifdef PACKET_LINK
--- 49,53 ----
  
  #ifdef LOW_POWER_LISTENING
! 		interface LowPowerListeningConfig;
  #endif
  #ifdef PACKET_LINK
***************
*** 56,60 ****
  	uses
  	{
! 		interface IEEE154PacketLayer;
  		interface RadioAlarm;
  
--- 58,62 ----
  	uses
  	{
! 		interface IEEE154MessageLayer;
  		interface RadioAlarm;
  
***************
*** 65,83 ****
  implementation
  {
  /*----------------- RF212DriverConfig -----------------*/
  
  	async command uint8_t RF212DriverConfig.getLength(message_t* msg)
  	{
! 		return call IEEE154PacketLayer.getLength(msg);
  	}
  
  	async command void RF212DriverConfig.setLength(message_t* msg, uint8_t len)
  	{
! 		call IEEE154PacketLayer.setLength(msg, len);
  	}
  
  	async command uint8_t* RF212DriverConfig.getPayload(message_t* msg)
  	{
! 		return ((uint8_t*)(call IEEE154PacketLayer.getHeader(msg))) + 1;
  	}
  
--- 67,95 ----
  implementation
  {
+ 	rf212packet_header_t* getHeader(message_t* msg)
+ 	{
+ 		return (rf212packet_header_t*)(msg->data - sizeof(rf212packet_header_t));
+ 	}
+ 
+ 	rf212packet_metadata_t* getMeta(message_t* msg)
+ 	{
+ 		return (rf212packet_metadata_t*)(msg->metadata);
+ 	}
+ 
  /*----------------- RF212DriverConfig -----------------*/
  
  	async command uint8_t RF212DriverConfig.getLength(message_t* msg)
  	{
! 		return call IEEE154MessageLayer.getLength(msg);
  	}
  
  	async command void RF212DriverConfig.setLength(message_t* msg, uint8_t len)
  	{
! 		call IEEE154MessageLayer.setLength(msg, len);
  	}
  
  	async command uint8_t* RF212DriverConfig.getPayload(message_t* msg)
  	{
! 		return ((uint8_t*)(call IEEE154MessageConfig.getHeader(msg))) + 1;
  	}
  
***************
*** 96,100 ****
  	async command bool RF212DriverConfig.requiresRssiCca(message_t* msg)
  	{
! 		return call IEEE154PacketLayer.isDataFrame(msg);
  	}
  
--- 108,112 ----
  	async command bool RF212DriverConfig.requiresRssiCca(message_t* msg)
  	{
! 		return call IEEE154MessageLayer.isDataFrame(msg);
  	}
  
***************
*** 103,132 ****
  	async command bool SoftwareAckConfig.requiresAckWait(message_t* msg)
  	{
! 		return call IEEE154PacketLayer.requiresAckWait(msg);
  	}
  
  	async command bool SoftwareAckConfig.isAckPacket(message_t* msg)
  	{
! 		return call IEEE154PacketLayer.isAckFrame(msg);
  	}
  
  	async command bool SoftwareAckConfig.verifyAckPacket(message_t* data, message_t* ack)
  	{
! 		return call IEEE154PacketLayer.verifyAckReply(data, ack);
  	}
  
  	async command void SoftwareAckConfig.setAckRequired(message_t* msg, bool ack)
  	{
! 		call IEEE154PacketLayer.setAckRequired(msg, ack);
  	}
  
  	async command bool SoftwareAckConfig.requiresAckReply(message_t* msg)
  	{
! 		return call IEEE154PacketLayer.requiresAckReply(msg);
  	}
  
  	async command void SoftwareAckConfig.createAckPacket(message_t* data, message_t* ack)
  	{
! 		call IEEE154PacketLayer.createAckReply(data, ack);
  	}
  
--- 115,144 ----
  	async command bool SoftwareAckConfig.requiresAckWait(message_t* msg)
  	{
! 		return call IEEE154MessageLayer.requiresAckWait(msg);
  	}
  
  	async command bool SoftwareAckConfig.isAckPacket(message_t* msg)
  	{
! 		return call IEEE154MessageLayer.isAckFrame(msg);
  	}
  
  	async command bool SoftwareAckConfig.verifyAckPacket(message_t* data, message_t* ack)
  	{
! 		return call IEEE154MessageLayer.verifyAckReply(data, ack);
  	}
  
  	async command void SoftwareAckConfig.setAckRequired(message_t* msg, bool ack)
  	{
! 		call IEEE154MessageLayer.setAckRequired(msg, ack);
  	}
  
  	async command bool SoftwareAckConfig.requiresAckReply(message_t* msg)
  	{
! 		return call IEEE154MessageLayer.requiresAckReply(msg);
  	}
  
  	async command void SoftwareAckConfig.createAckPacket(message_t* data, message_t* ack)
  	{
! 		call IEEE154MessageLayer.createAckReply(data, ack);
  	}
  
***************
*** 145,159 ****
  	async command uint8_t UniqueConfig.getSequenceNumber(message_t* msg)
  	{
! 		return call IEEE154PacketLayer.getDSN(msg);
  	}
  
  	async command void UniqueConfig.setSequenceNumber(message_t* msg, uint8_t dsn)
  	{
! 		call IEEE154PacketLayer.setDSN(msg, dsn);
  	}
  
  	async command am_addr_t UniqueConfig.getSender(message_t* msg)
  	{
! 		return call IEEE154PacketLayer.getSrcAddr(msg);
  	}
  
--- 157,171 ----
  	async command uint8_t UniqueConfig.getSequenceNumber(message_t* msg)
  	{
! 		return call IEEE154MessageLayer.getDSN(msg);
  	}
  
  	async command void UniqueConfig.setSequenceNumber(message_t* msg, uint8_t dsn)
  	{
! 		call IEEE154MessageLayer.setDSN(msg, dsn);
  	}
  
  	async command am_addr_t UniqueConfig.getSender(message_t* msg)
  	{
! 		return call IEEE154MessageLayer.getSrcAddr(msg);
  	}
  
***************
*** 168,172 ****
  	{
  		// the user forgot to call clear, we should return EINVAL
! 		if( ! call IEEE154PacketLayer.isDataFrame(msg) )
  			call Packet.clear(msg);
  
--- 180,184 ----
  	{
  		// the user forgot to call clear, we should return EINVAL
! 		if( ! call IEEE154MessageLayer.isDataFrame(msg) )
  			call Packet.clear(msg);
  
***************
*** 174,182 ****
  	}
  
  /*----------------- CsmaConfig -----------------*/
  
  	async command bool CsmaConfig.requiresSoftwareCCA(message_t* msg)
  	{
! 		return call IEEE154PacketLayer.isDataFrame(msg);
  	}
  
--- 186,229 ----
  	}
  
+ 	command activemessage_header_t* ActiveMessageConfig.getHeader(message_t* msg)
+ 	{
+ 		return &(getHeader(msg)->am);
+ 	}
+ 
+ 	command am_addr_t ActiveMessageConfig.destination(message_t* msg)
+ 	{
+ 		return call IEEE154MessageLayer.getDestAddr(msg);
+ 	}
+ 
+ 	command void ActiveMessageConfig.setDestination(message_t* msg, am_addr_t addr)
+ 	{
+ 		call IEEE154MessageLayer.setDestAddr(msg, addr);
+ 	}
+ 
+ 	command am_addr_t ActiveMessageConfig.source(message_t* msg)
+ 	{
+ 		return call IEEE154MessageLayer.getSrcAddr(msg);
+ 	}
+ 
+ 	command void ActiveMessageConfig.setSource(message_t* msg, am_addr_t addr)
+ 	{
+ 		call IEEE154MessageLayer.setSrcAddr(msg, addr);
+ 	}
+ 
+ 	command am_group_t ActiveMessageConfig.group(message_t* msg)
+ 	{
+ 		return call IEEE154MessageLayer.getDestPan(msg);
+ 	}
+ 
+ 	command void ActiveMessageConfig.setGroup(message_t* msg, am_group_t grp)
+ 	{
+ 		call IEEE154MessageLayer.setDestPan(msg, grp);
+ 	}
+ 
  /*----------------- CsmaConfig -----------------*/
  
  	async command bool CsmaConfig.requiresSoftwareCCA(message_t* msg)
  	{
! 		return call IEEE154MessageLayer.isDataFrame(msg);
  	}
  
***************
*** 203,213 ****
  		 */
  
! 		uint8_t len = call IEEE154PacketLayer.getLength(msg);
! 		return call IEEE154PacketLayer.getAckRequired(msg) ? len + 6 + 16 + 11 + 10 : len + 6 + 10;
  	}
  
  	async command am_addr_t TrafficMonitorConfig.getSender(message_t* msg)
  	{
! 		return call IEEE154PacketLayer.getSrcAddr(msg);
  	}
  
--- 250,260 ----
  		 */
  
! 		uint8_t len = call IEEE154MessageLayer.getLength(msg);
! 		return call IEEE154MessageLayer.getAckRequired(msg) ? len + 6 + 16 + 11 + 10 : len + 6 + 10;
  	}
  
  	async command am_addr_t TrafficMonitorConfig.getSender(message_t* msg)
  	{
! 		return call IEEE154MessageLayer.getSrcAddr(msg);
  	}
  
***************
*** 251,255 ****
  
  		// estimated response time (download the message, etc) is 5-8 bytes
! 		if( call IEEE154PacketLayer.requiresAckReply(msg) )
  			time += (uint16_t)(32 * (-5 + 16 + 11 + 5) * RADIO_ALARM_MICROSEC);
  		else
--- 298,302 ----
  
  		// estimated response time (download the message, etc) is 5-8 bytes
! 		if( call IEEE154MessageLayer.requiresAckReply(msg) )
  			time += (uint16_t)(32 * (-5 + 16 + 11 + 5) * RADIO_ALARM_MICROSEC);
  		else
***************
*** 259,263 ****
  	}
  
! 	tasklet_async event void RadioAlarm.fired()	{ }
  
  /*----------------- SlottedCollisionConfig -----------------*/
--- 306,312 ----
  	}
  
! 	tasklet_async event void RadioAlarm.fired()
! 	{
! 	}
  
  /*----------------- SlottedCollisionConfig -----------------*/
***************
*** 298,308 ****
  	}
  
! /*----------------- Metadata -----------------*/
  
! 	inline rf212packet_metadata_t* getMeta(message_t* msg)
  	{
! 		return (rf212packet_metadata_t*)(msg->metadata);
  	}
  
  	async command flags_metadata_t* PacketFlagsMetadata.get(message_t* msg)
  	{
--- 347,382 ----
  	}
  
! /*----------------- LowpanNetwork -----------------*/
  
! 	command lowpan_header_t* LowpanNetworkConfig.getHeader(message_t* msg)
  	{
! 		return &(getHeader(msg)->lowpan);
! 	}
! 
! /*----------------- IEEE154Message -----------------*/
! 
! 	async command ieee154_header_t* IEEE154MessageConfig.getHeader(message_t* msg)
! 	{
! 		return &(getHeader(msg)->ieee154);
! 	}
! 
! /*----------------- LowPowerListening -----------------*/
! 
! #ifdef LOW_POWER_LISTENING
! 
! 	async command lpl_metadata_t* LowPowerListeningConfig.metadata(message_t* msg)
! 	{
! 		return &(getMeta(msg)->lpl);
! 	}
! 
! 	async command bool LowPowerListeningConfig.getAckRequired(message_t* msg)
! 	{
! 		return call IEEE154MessageLayer.getAckRequired(msg);
  	}
  
+ #endif
+ 
+ /*----------------- Headers and Metadata -----------------*/
+ 
  	async command flags_metadata_t* PacketFlagsMetadata.get(message_t* msg)
  	{
***************
*** 320,330 ****
  	}
  
- #ifdef LOW_POWER_LISTENING
- 	async command lpl_metadata_t* PacketLplMetadata.get(message_t* msg)
- 	{
- 		return &(getMeta(msg)->lpl);
- 	}
- #endif
- 
  #ifdef PACKET_LINK
  	async command link_metadata_t* PacketLinkMetadata.get(message_t* msg)
--- 394,397 ----
***************
*** 349,371 ****
  		signal PacketTimeStampMetadata.clear(msg);
  #ifdef LOW_POWER_LISTENING
! 		signal PacketLplMetadata.clear(msg);
  #endif
  #ifdef PACKET_LINK
  		signal PacketLinkMetadata.clear(msg);
  #endif
! 		call IEEE154PacketLayer.createDataFrame(msg);
  	}
  
! 	inline command void Packet.setPayloadLength(message_t* msg, uint8_t len)
  	{
! 		call IEEE154PacketLayer.setLength(msg, len + PACKET_LENGTH_INCREASE);
  	}
  
! 	inline command uint8_t Packet.payloadLength(message_t* msg)
  	{
! 		return call IEEE154PacketLayer.getLength(msg) - PACKET_LENGTH_INCREASE;
  	}
  
! 	inline command uint8_t Packet.maxPayloadLength()
  	{
  		return TOSH_DATA_LENGTH;
--- 416,438 ----
  		signal PacketTimeStampMetadata.clear(msg);
  #ifdef LOW_POWER_LISTENING
! 		signal LowPowerListeningConfig.clear(msg);
  #endif
  #ifdef PACKET_LINK
  		signal PacketLinkMetadata.clear(msg);
  #endif
! 		call IEEE154MessageLayer.createDataFrame(msg);
  	}
  
! 	command void Packet.setPayloadLength(message_t* msg, uint8_t len)
  	{
! 		call IEEE154MessageLayer.setLength(msg, len + PACKET_LENGTH_INCREASE);
  	}
  
! 	command uint8_t Packet.payloadLength(message_t* msg)
  	{
! 		return call IEEE154MessageLayer.getLength(msg) - PACKET_LENGTH_INCREASE;
  	}
  
! 	command uint8_t Packet.maxPayloadLength()
  	{
  		return TOSH_DATA_LENGTH;



More information about the Tinyos-2-commits mailing list