[Tinyos-2-commits] CVS: tinyos-2.x/tos/chips/rf2xx/layers IEEE154PacketLayer.h, NONE, 1.1 IEEE154PacketLayer.nc, NONE, 1.1 IEEE154PacketLayerC.nc, NONE, 1.1 IEEE154PacketLayerP.nc, NONE, 1.1 LowPowerListeningDummyC.nc, NONE, 1.1 LowPowerListeningDummyP.nc, NONE, 1.1 LowPowerListeningLayer.h, NONE, 1.1 MetadataFlagsLayer.h, NONE, 1.1 MetadataFlagsLayerC.nc, NONE, 1.1 TimeStampingLayer.h, NONE, 1.1 TimeStampingLayerC.nc, NONE, 1.1 TimeStampingLayerP.nc, NONE, 1.1 DummyLayerC.nc, 1.1, 1.2 IEEE154NetworkLayerC.nc, 1.2, 1.3 IEEE154NetworkLayerP.nc, 1.2, 1.3 LowPowerListeningLayerC.nc, 1.2, 1.3 LowPowerListeningLayerP.nc, 1.2, 1.3 PacketLinkLayer.h, 1.1, 1.2 PacketLinkLayerC.nc, 1.1, 1.2 PacketLinkLayerP.nc, 1.1, 1.2 SoftwareAckConfig.nc, 1.1, 1.2 SoftwareAckLayerC.nc, 1.1, 1.2 SoftwareAckLayerP.nc, 1.1, 1.2 DummyLayerP.nc, 1.1, NONE
Miklos Maroti
mmaroti at users.sourceforge.net
Thu Apr 2 15:10:09 PDT 2009
- Previous message: [Tinyos-2-commits] CVS: tinyos-2.x/tos/lib/mac/tkn154 DispatchSlottedCsmaP.nc, 1.2, 1.3 DispatchUnslottedCsmaP.nc, 1.3, 1.4 README.txt, 1.5, 1.6
- Next message: [Tinyos-2-commits] CVS: tinyos-2.x/tos/chips/rf2xx/rf212 RF212ActiveMessage.h, NONE, 1.1 RF212DriverLayer.h, NONE, 1.1 RF212ActiveMessageC.nc, 1.3, 1.4 RF212ActiveMessageP.nc, 1.3, 1.4 RF212DriverLayerC.nc, 1.1, 1.2 RF212DriverLayerP.nc, 1.2, 1.3 RF212.h, 1.1, NONE RF212Packet.h, 1.3, NONE RF212PacketC.nc, 1.3, NONE RF212PacketP.nc, 1.3, NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/tinyos/tinyos-2.x/tos/chips/rf2xx/layers
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv8351/layers
Modified Files:
DummyLayerC.nc IEEE154NetworkLayerC.nc IEEE154NetworkLayerP.nc
LowPowerListeningLayerC.nc LowPowerListeningLayerP.nc
PacketLinkLayer.h PacketLinkLayerC.nc PacketLinkLayerP.nc
SoftwareAckConfig.nc SoftwareAckLayerC.nc SoftwareAckLayerP.nc
Added Files:
IEEE154PacketLayer.h IEEE154PacketLayer.nc
IEEE154PacketLayerC.nc IEEE154PacketLayerP.nc
LowPowerListeningDummyC.nc LowPowerListeningDummyP.nc
LowPowerListeningLayer.h MetadataFlagsLayer.h
MetadataFlagsLayerC.nc TimeStampingLayer.h
TimeStampingLayerC.nc TimeStampingLayerP.nc
Removed Files:
DummyLayerP.nc
Log Message:
change metadata handling,
remove the RF2xxPacket component, move functionality to RF2xxActiveMessage,
prepare blip support (RF2xxMessageC)
--- NEW FILE: IEEE154PacketLayer.h ---
/*
* Copyright (c) 2007, Vanderbilt University
* All rights reserved.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose, without fee, and without written agreement is
* hereby granted, provided that the above copyright notice, the following
* two paragraphs and the author appear in all copies of this software.
*
* IN NO EVENT SHALL THE VANDERBILT UNIVERSITY BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
* OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE VANDERBILT
* UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* THE VANDERBILT UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE VANDERBILT UNIVERSITY HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*
* Author: Miklos Maroti
*/
#ifndef __IEEE154PACKETLAYER_H__
#define __IEEE154PACKETLAYER_H__
typedef nx_struct ieee154_header_t
{
nxle_uint8_t length;
nxle_uint16_t fcf;
nxle_uint8_t dsn;
nxle_uint16_t destpan;
nxle_uint16_t dest;
nxle_uint16_t src;
// I-Frame 6LowPAN interoperability byte
#ifndef TFRAMES_ENABLED
nxle_uint8_t network;
#endif
nxle_uint8_t type;
} 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,
IEEE154_FCF_SECURITY_ENABLED = 3,
IEEE154_FCF_FRAME_PENDING = 4,
IEEE154_FCF_ACK_REQ = 5,
IEEE154_FCF_INTRAPAN = 6,
IEEE154_FCF_DEST_ADDR_MODE = 10,
IEEE154_FCF_SRC_ADDR_MODE = 14,
};
enum ieee154_fcf_type_enums {
IEEE154_TYPE_BEACON = 0,
IEEE154_TYPE_DATA = 1,
IEEE154_TYPE_ACK = 2,
IEEE154_TYPE_MAC_CMD = 3,
IEEE154_TYPE_MASK = 7,
};
enum iee154_fcf_addr_mode_enums {
IEEE154_ADDR_NONE = 0,
IEEE154_ADDR_SHORT = 2,
IEEE154_ADDR_EXT = 3,
IEEE154_ADDR_MASK = 3,
};
#endif//__IEEE154PACKETLAYER_H__
--- NEW FILE: IEEE154PacketLayer.nc ---
/*
* Copyright (c) 2007, Vanderbilt University
* All rights reserved.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose, without fee, and without written agreement is
* hereby granted, provided that the above copyright notice, the following
* two paragraphs and the author appear in all copies of this software.
*
* IN NO EVENT SHALL THE VANDERBILT UNIVERSITY BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
* OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE VANDERBILT
* UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* THE VANDERBILT UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE VANDERBILT UNIVERSITY HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*
* Author: Miklos Maroti
*/
#include <IEEE154PacketLayer.h>
#include <message.h>
/**
* This interface encapsulates IEEE 802.15.4 intrapan data frames with
* 16-bit destination pan, source and destination addresses. It also
* supports 6LowPan interoperability mode, and acknowledgement frames.
* Note, that this interface does not support the CRC-16 value, which
* should be verified before the data can be trusted.
*/
interface IEEE154PacketLayer
{
/**
* Returns the IEEE 802.15.4 header including the length field.
*/
async command ieee154_header_t* getHeader(message_t* msg);
/**
* 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.
*/
async command uint16_t getFCF(message_t* msg);
/**
* Sets the frame control field. This method should not be used,
* createDataFrame and createAckFrame should be used instead.
*/
async command void setFCF(message_t* msg, uint16_t fcf);
/**
* Returns TRUE if the message is a data frame supported by
* this interface (based on the value of the FCF).
*/
async command bool isDataFrame(message_t* msg);
/**
* Sets the FCF to create a data frame supported by this interface.
* You may call setAckRequired and setFramePending commands after this.
*/
async command void createDataFrame(message_t* msg);
/**
* Returns TRUE if the message is an acknowledgement frame supported
* by this interface (based on the value of the FCF).
*/
async command bool isAckFrame(message_t* msg);
/**
* Sets the FCF to create an acknowledgement frame supported by
* this interface. You may call setFramePending after this.
*/
async command void createAckFrame(message_t* msg);
/**
* Creates an acknowledgement packet for the given data packet.
* This also sets the DSN value. The data message must be a
* data frame, the ack message will be overwritten.
*/
async command void createAckReply(message_t* data, message_t* ack);
/**
* Returns TRUE if the acknowledgement packet corresponds to the
* data packet. The data message must be a data packet.
*/
async command bool verifyAckReply(message_t* data, message_t* ack);
/**
* Returns TRUE if the ACK required field is set in the FCF.
*/
async command bool getAckRequired(message_t* msg);
/**
* Sets the ACK required field in the FCF, should never be set
* for acknowledgement frames.
*/
async command void setAckRequired(message_t* msg, bool ack);
/**
* Returns TRUE if the frame pending field is set in the FCF.
*/
async command bool getFramePending(message_t* msg);
/**
* Sets the frame pending field in the FCF.
*/
async command void setFramePending(message_t* msg, bool pending);
/**
* Returns the data sequence number
*/
async command uint8_t getDSN(message_t* msg);
/**
* Sets the data sequence number
*/
async command void setDSN(message_t* msg, uint8_t dsn);
/**
* returns the destination PAN id, values <= 255 are tinyos groups,
* valid only for data frames
*/
async command uint16_t getDestPan(message_t* msg);
/**
* Sets the destination PAN id, valid only for data frames
*/
async command void setDestPan(message_t* msg, uint16_t pan);
/**
* Returns the destination address, valid only for data frames
*/
async command uint16_t getDestAddr(message_t* msg);
/**
* Sets the destination address, valid only for data frames
*/
async command void setDestAddr(message_t* msg, uint16_t addr);
/**
* Returns the source address, valid only for data frames
*/
async command uint16_t getSrcAddr(message_t* msg);
/**
* Sets the source address, valid only for data frames
*/
async command void setSrcAddr(message_t* msg, uint16_t addr);
#ifndef TFRAMES_ENABLED
/**
* Returns the value of the 6LowPan network field.
*/
async command uint8_t get6LowPan(message_t* msg);
/**
* Sets the value of the 6LowPan network field.
*/
async command void set6LowPan(message_t* msg, uint8_t network);
#endif
/**
* Returns the active message type of the message
*/
async command am_id_t getType(message_t* msg);
/**
* Sets the active message type
*/
async command void setType(message_t* msg, am_id_t type);
/**
* Returns TRUE if the packet is a data packet, the ACK_REQ field
* is set and the destination address is not the broadcast address.
*/
async command bool requiresAckWait(message_t* msg);
/**
* Returns TRUE if the packet is a data packet, the ACK_REQ field
* is set and the destionation address is this node.
*/
async command bool requiresAckReply(message_t* msg);
}
--- NEW FILE: IEEE154PacketLayerC.nc ---
/*
* Copyright (c) 2007, Vanderbilt University
* All rights reserved.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose, without fee, and without written agreement is
* hereby granted, provided that the above copyright notice, the following
* two paragraphs and the author appear in all copies of this software.
*
* IN NO EVENT SHALL THE VANDERBILT UNIVERSITY BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
* OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE VANDERBILT
* UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* THE VANDERBILT UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE VANDERBILT UNIVERSITY HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*
* Author: Miklos Maroti
*/
configuration IEEE154PacketLayerC
{
provides
{
interface IEEE154PacketLayer;
interface AMPacket;
}
}
implementation
{
components IEEE154PacketLayerP, ActiveMessageAddressC;
IEEE154PacketLayerP.ActiveMessageAddress -> ActiveMessageAddressC;
IEEE154PacketLayer = IEEE154PacketLayerP;
AMPacket = IEEE154PacketLayerP;
}
--- NEW FILE: IEEE154PacketLayerP.nc ---
/*
* Copyright (c) 2007, Vanderbilt University
* All rights reserved.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose, without fee, and without written agreement is
* hereby granted, provided that the above copyright notice, the following
* two paragraphs and the author appear in all copies of this software.
*
* IN NO EVENT SHALL THE VANDERBILT UNIVERSITY BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
* OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE VANDERBILT
* UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* THE VANDERBILT UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE VANDERBILT UNIVERSITY HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*
* Author: Miklos Maroti
*/
#include <IEEE154PacketLayer.h>
module IEEE154PacketLayerP
{
provides
{
interface IEEE154PacketLayer;
interface AMPacket;
}
uses interface ActiveMessageAddress;
}
implementation
{
/*----------------- IEEE154Packet -----------------*/
enum
{
IEEE154_DATA_FRAME_MASK = (IEEE154_TYPE_MASK << IEEE154_FCF_FRAME_TYPE)
| (1 << IEEE154_FCF_INTRAPAN)
| (IEEE154_ADDR_MASK << IEEE154_FCF_DEST_ADDR_MODE)
| (IEEE154_ADDR_MASK << IEEE154_FCF_SRC_ADDR_MODE),
IEEE154_DATA_FRAME_VALUE = (IEEE154_TYPE_DATA << IEEE154_FCF_FRAME_TYPE)
| (1 << IEEE154_FCF_INTRAPAN)
| (IEEE154_ADDR_SHORT << IEEE154_FCF_DEST_ADDR_MODE)
| (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),
};
inline ieee154_header_t* getHeader(message_t* msg)
{
return (ieee154_header_t*)(msg->data - sizeof(ieee154_header_t));
}
inline async command ieee154_header_t* IEEE154PacketLayer.getHeader(message_t* msg)
{
return getHeader(msg);
}
inline async command uint8_t IEEE154PacketLayer.getLength(message_t* msg)
{
return getHeader(msg)->length;
}
inline async command void IEEE154PacketLayer.setLength(message_t* msg, uint8_t length)
{
getHeader(msg)->length = length;
}
inline async command uint16_t IEEE154PacketLayer.getFCF(message_t* msg)
{
return getHeader(msg)->fcf;
}
inline async command void IEEE154PacketLayer.setFCF(message_t* msg, uint16_t fcf)
{
getHeader(msg)->fcf = fcf;
}
inline async command bool IEEE154PacketLayer.isDataFrame(message_t* msg)
{
return (getHeader(msg)->fcf & IEEE154_DATA_FRAME_MASK) == IEEE154_DATA_FRAME_VALUE;
}
inline async command void IEEE154PacketLayer.createDataFrame(message_t* msg)
{
getHeader(msg)->fcf = IEEE154_DATA_FRAME_VALUE;
}
inline async command bool IEEE154PacketLayer.isAckFrame(message_t* msg)
{
return (getHeader(msg)->fcf & IEEE154_ACK_FRAME_MASK) == IEEE154_ACK_FRAME_VALUE;
}
inline async command void IEEE154PacketLayer.createAckFrame(message_t* msg)
{
ieee154_header_t* header = getHeader(msg);
header->length = IEEE154_ACK_FRAME_LENGTH;
header->fcf = IEEE154_ACK_FRAME_VALUE;
}
inline async command void IEEE154PacketLayer.createAckReply(message_t* data, message_t* ack)
{
ieee154_header_t* header = getHeader(ack);
header->length = IEEE154_ACK_FRAME_LENGTH;
header->fcf = IEEE154_ACK_FRAME_VALUE;
header->dsn = getHeader(data)->dsn;
}
inline async command bool IEEE154PacketLayer.verifyAckReply(message_t* data, message_t* ack)
{
ieee154_header_t* header = getHeader(ack);
return header->dsn == getHeader(data)->dsn
&& (header->fcf & IEEE154_ACK_FRAME_MASK) == IEEE154_ACK_FRAME_VALUE;
}
inline async command bool IEEE154PacketLayer.getAckRequired(message_t* msg)
{
return getHeader(msg)->fcf & (1 << IEEE154_FCF_ACK_REQ);
}
inline async command void IEEE154PacketLayer.setAckRequired(message_t* msg, bool ack)
{
if( ack )
getHeader(msg)->fcf |= (1 << IEEE154_FCF_ACK_REQ);
else
getHeader(msg)->fcf &= ~(uint16_t)(1 << IEEE154_FCF_ACK_REQ);
}
inline async command bool IEEE154PacketLayer.getFramePending(message_t* msg)
{
return getHeader(msg)->fcf & (1 << IEEE154_FCF_FRAME_PENDING);
}
inline async command void IEEE154PacketLayer.setFramePending(message_t* msg, bool pending)
{
if( pending )
getHeader(msg)->fcf |= (1 << IEEE154_FCF_FRAME_PENDING);
else
getHeader(msg)->fcf &= ~(uint16_t)(1 << IEEE154_FCF_FRAME_PENDING);
}
inline async command uint8_t IEEE154PacketLayer.getDSN(message_t* msg)
{
return getHeader(msg)->dsn;
}
inline async command void IEEE154PacketLayer.setDSN(message_t* msg, uint8_t dsn)
{
getHeader(msg)->dsn = dsn;
}
inline async command uint16_t IEEE154PacketLayer.getDestPan(message_t* msg)
{
return getHeader(msg)->destpan;
}
inline async command void IEEE154PacketLayer.setDestPan(message_t* msg, uint16_t pan)
{
getHeader(msg)->destpan = pan;
}
inline async command uint16_t IEEE154PacketLayer.getDestAddr(message_t* msg)
{
return getHeader(msg)->dest;
}
inline async command void IEEE154PacketLayer.setDestAddr(message_t* msg, uint16_t addr)
{
getHeader(msg)->dest = addr;
}
inline async command uint16_t IEEE154PacketLayer.getSrcAddr(message_t* msg)
{
return getHeader(msg)->src;
}
inline async command void IEEE154PacketLayer.setSrcAddr(message_t* msg, uint16_t addr)
{
getHeader(msg)->src = addr;
}
#ifndef TFRAMES_ENABLED
inline async command uint8_t IEEE154PacketLayer.get6LowPan(message_t* msg)
{
return getHeader(msg)->network;
}
inline async command void IEEE154PacketLayer.set6LowPan(message_t* msg, uint8_t network)
{
getHeader(msg)->network = network;
}
#endif
inline async command am_id_t IEEE154PacketLayer.getType(message_t* msg)
{
return getHeader(msg)->type;
}
inline async command void IEEE154PacketLayer.setType(message_t* msg, am_id_t type)
{
getHeader(msg)->type = type;
}
async command bool IEEE154PacketLayer.requiresAckWait(message_t* msg)
{
return call IEEE154PacketLayer.getAckRequired(msg)
&& call IEEE154PacketLayer.isDataFrame(msg)
&& call IEEE154PacketLayer.getDestAddr(msg) != 0xFFFF;
}
async command bool IEEE154PacketLayer.requiresAckReply(message_t* msg)
{
return call IEEE154PacketLayer.getAckRequired(msg)
&& call IEEE154PacketLayer.isDataFrame(msg)
&& call IEEE154PacketLayer.getDestAddr(msg) == call ActiveMessageAddress.amAddress();
}
inline async event void ActiveMessageAddress.changed()
{
}
/*----------------- AMPacket -----------------*/
inline command am_addr_t AMPacket.address()
{
return call ActiveMessageAddress.amAddress();
}
inline command am_group_t AMPacket.localGroup()
{
// TODO: check if this is correct
return call ActiveMessageAddress.amGroup();
}
inline command am_addr_t AMPacket.destination(message_t* msg)
{
return call IEEE154PacketLayer.getDestAddr(msg);
}
inline command am_addr_t AMPacket.source(message_t* msg)
{
return call IEEE154PacketLayer.getSrcAddr(msg);
}
inline command void AMPacket.setDestination(message_t* msg, am_addr_t addr)
{
call IEEE154PacketLayer.setDestAddr(msg, addr);
}
inline command void AMPacket.setSource(message_t* msg, am_addr_t addr)
{
call IEEE154PacketLayer.setSrcAddr(msg, addr);
}
inline command bool AMPacket.isForMe(message_t* msg)
{
am_addr_t addr = call AMPacket.destination(msg);
return addr == call AMPacket.address() || addr == AM_BROADCAST_ADDR;
}
inline command am_id_t AMPacket.type(message_t* msg)
{
return call IEEE154PacketLayer.getType(msg);
}
inline command void AMPacket.setType(message_t* msg, am_id_t type)
{
call IEEE154PacketLayer.setType(msg, type);
}
inline command am_group_t AMPacket.group(message_t* msg)
{
return call IEEE154PacketLayer.getDestPan(msg);
}
inline command void AMPacket.setGroup(message_t* msg, am_group_t grp)
{
call IEEE154PacketLayer.setDestPan(msg, grp);
}
}
--- NEW FILE: LowPowerListeningDummyC.nc ---
/*
* Copyright (c) 2009, Vanderbilt University
* All rights reserved.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose, without fee, and without written agreement is
* hereby granted, provided that the above copyright notice, the following
* two paragraphs and the author appear in all copies of this software.
*
* IN NO EVENT SHALL THE VANDERBILT UNIVERSITY BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
* OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE VANDERBILT
* UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* THE VANDERBILT UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE VANDERBILT UNIVERSITY HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*
* Author: Miklos Maroti
*/
configuration LowPowerListeningDummyC
{
provides
{
interface SplitControl;
interface Send;
interface Receive;
interface LowPowerListening;
}
uses
{
interface SplitControl as SubControl;
interface Send as SubSend;
interface Receive as SubReceive;
}
}
implementation
{
SplitControl = SubControl;
Send = SubSend;
Receive = SubReceive;
components LowPowerListeningDummyP;
LowPowerListening = LowPowerListeningDummyP;
}
--- NEW FILE: LowPowerListeningDummyP.nc ---
/*
* Copyright (c) 2007, Vanderbilt University
* All rights reserved.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose, without fee, and without written agreement is
* hereby granted, provided that the above copyright notice, the following
* two paragraphs and the author appear in all copies of this software.
*
* IN NO EVENT SHALL THE VANDERBILT UNIVERSITY BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
* OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE VANDERBILT
* UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* THE VANDERBILT UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE VANDERBILT UNIVERSITY HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*
* Author: Miklos Maroti
*/
module LowPowerListeningDummyP
{
provides interface LowPowerListening;
}
implementation
{
command void LowPowerListening.setLocalSleepInterval(uint16_t sleepIntervalMs) { }
command uint16_t LowPowerListening.getLocalSleepInterval() { return 0; }
command void LowPowerListening.setLocalDutyCycle(uint16_t dutyCycle) { }
command uint16_t LowPowerListening.getLocalDutyCycle() { return 10000; }
command void LowPowerListening.setRxSleepInterval(message_t *msg, uint16_t sleepIntervalMs) { }
command uint16_t LowPowerListening.getRxSleepInterval(message_t *msg) { return 0; }
command void LowPowerListening.setRxDutyCycle(message_t *msg, uint16_t dutyCycle) { }
command uint16_t LowPowerListening.getRxDutyCycle(message_t *msg) { return 10000; }
command uint16_t LowPowerListening.dutyCycleToSleepInterval(uint16_t dutyCycle) { return 0; }
command uint16_t LowPowerListening.sleepIntervalToDutyCycle(uint16_t sleepInterval) { return 10000; }
}
--- NEW FILE: LowPowerListeningLayer.h ---
/*
* Copyright (c) 2007, Vanderbilt University
* All rights reserved.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose, without fee, and without written agreement is
* hereby granted, provided that the above copyright notice, the following
* two paragraphs and the author appear in all copies of this software.
*
* IN NO EVENT SHALL THE VANDERBILT UNIVERSITY BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
* OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE VANDERBILT
* UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* THE VANDERBILT UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE VANDERBILT UNIVERSITY HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*
* Author: Miklos Maroti
*/
#ifndef __LOWPOWERLISTENINGLAYER_H__
#define __LOWPOWERLISTENINGLAYER_H__
typedef struct lpl_metadata_t
{
uint16_t sleepint;
} lpl_metadata_t;
#endif//__LOWPOWERLISTENINGLAYER_H__
--- NEW FILE: MetadataFlagsLayer.h ---
/*
* Copyright (c) 2009, Vanderbilt University
* All rights reserved.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose, without fee, and without written agreement is
* hereby granted, provided that the above copyright notice, the following
* two paragraphs and the author appear in all copies of this software.
*
* IN NO EVENT SHALL THE VANDERBILT UNIVERSITY BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
* OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE VANDERBILT
* UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* THE VANDERBILT UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE VANDERBILT UNIVERSITY HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*
* Author: Miklos Maroti
*/
#ifndef __METADATAFLAGSLAYER_H__
#define __METADATAFLAGSLAYER_H__
typedef struct flags_metadata_t
{
// TODO: make sure that we have no more than 8 flags
uint8_t flags;
} flags_metadata_t;
#endif//__METADATAFLAGSLAYER_H__
--- NEW FILE: MetadataFlagsLayerC.nc ---
/*
* Copyright (c) 2007, Vanderbilt University
* All rights reserved.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose, without fee, and without written agreement is
* hereby granted, provided that the above copyright notice, the following
* two paragraphs and the author appear in all copies of this software.
*
* IN NO EVENT SHALL THE VANDERBILT UNIVERSITY BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
* OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE VANDERBILT
* UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* THE VANDERBILT UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE VANDERBILT UNIVERSITY HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*
* Author: Miklos Maroti
*/
#include <MetadataFlagsLayer.h>
#include <RadioAssert.h>
module MetadataFlagsLayerC
{
provides
{
interface PacketFlag[uint8_t bit];
}
uses
{
interface PacketData<flags_metadata_t> as PacketFlagsMetadata;
}
}
implementation
{
async command bool PacketFlag.get[uint8_t bit](message_t* msg)
{
return (call PacketFlagsMetadata.get(msg))->flags & (1<<bit);
}
async command void PacketFlag.set[uint8_t bit](message_t* msg)
{
ASSERT( bit < 8 );
(call PacketFlagsMetadata.get(msg))->flags |= (1<<bit);
}
async command void PacketFlag.clear[uint8_t bit](message_t* msg)
{
ASSERT( bit < 8 );
(call PacketFlagsMetadata.get(msg))->flags &= ~(1<<bit);
}
async command void PacketFlag.setValue[uint8_t bit](message_t* msg, bool value)
{
if( value )
call PacketFlag.set[bit](msg);
else
call PacketFlag.clear[bit](msg);
}
async event void PacketFlagsMetadata.clear(message_t* msg)
{
(call PacketFlagsMetadata.get(msg))->flags = 0;
}
}
--- NEW FILE: TimeStampingLayer.h ---
/*
* Copyright (c) 2007, Vanderbilt University
* All rights reserved.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose, without fee, and without written agreement is
* hereby granted, provided that the above copyright notice, the following
* two paragraphs and the author appear in all copies of this software.
*
* IN NO EVENT SHALL THE VANDERBILT UNIVERSITY BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
* OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE VANDERBILT
* UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* THE VANDERBILT UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE VANDERBILT UNIVERSITY HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*
* Author: Miklos Maroti
*/
#ifndef __TIMESTAMPINGLAYER_H__
#define __TIMESTAMPINGLAYER_H__
typedef struct timestamp_metadata_t
{
uint32_t timestamp;
} timestamp_metadata_t;
#endif//__TIMESTAMPINGLAYER_H__
--- NEW FILE: TimeStampingLayerC.nc ---
/*
* Copyright (c) 2007, Vanderbilt University
* All rights reserved.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose, without fee, and without written agreement is
* hereby granted, provided that the above copyright notice, the following
* two paragraphs and the author appear in all copies of this software.
*
* IN NO EVENT SHALL THE VANDERBILT UNIVERSITY BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
* OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE VANDERBILT
* UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* THE VANDERBILT UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE VANDERBILT UNIVERSITY HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*
* Author: Miklos Maroti
*/
configuration TimeStampingLayerC
{
provides
{
interface PacketTimeStamp<TMilli, uint32_t> as PacketTimeStampMilli;
interface PacketTimeStamp<TRadio, uint32_t> as PacketTimeStampRadio;
}
uses
{
interface LocalTime<TRadio> as LocalTimeRadio;
interface PacketData<timestamp_metadata_t> as PacketTimeStampMetadata;
}
}
implementation
{
components TimeStampingLayerP, LocalTimeMilliC;
PacketTimeStampMilli = TimeStampingLayerP;
PacketTimeStampRadio = TimeStampingLayerP;
PacketTimeStampMetadata = TimeStampingLayerP.PacketTimeStampMetadata;
LocalTimeRadio = TimeStampingLayerP;
TimeStampingLayerP.LocalTimeMilli -> LocalTimeMilliC;
components new MetadataFlagC() as TimeStampFlagC;
TimeStampingLayerP.TimeStampFlag -> TimeStampFlagC;
}
--- NEW FILE: TimeStampingLayerP.nc ---
/*
* Copyright (c) 2007, Vanderbilt University
* All rights reserved.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose, without fee, and without written agreement is
* hereby granted, provided that the above copyright notice, the following
* two paragraphs and the author appear in all copies of this software.
*
* IN NO EVENT SHALL THE VANDERBILT UNIVERSITY BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
* OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE VANDERBILT
* UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* THE VANDERBILT UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE VANDERBILT UNIVERSITY HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*
* Author: Miklos Maroti
*/
#include <RadioConfig.h>
#include <TimeStampingLayer.h>
module TimeStampingLayerP
{
provides
{
interface PacketTimeStamp<TMilli, uint32_t> as PacketTimeStampMilli;
interface PacketTimeStamp<TRadio, uint32_t> as PacketTimeStampRadio;
}
uses
{
interface PacketFlag as TimeStampFlag;
interface LocalTime<TRadio> as LocalTimeRadio;
interface LocalTime<TMilli> as LocalTimeMilli;
interface PacketData<timestamp_metadata_t> as PacketTimeStampMetadata;
}
}
implementation
{
async command bool PacketTimeStampRadio.isValid(message_t* msg)
{
return call TimeStampFlag.get(msg);
}
async command uint32_t PacketTimeStampRadio.timestamp(message_t* msg)
{
return (call PacketTimeStampMetadata.get(msg))->timestamp;
}
async command void PacketTimeStampRadio.clear(message_t* msg)
{
call TimeStampFlag.clear(msg);
}
async command void PacketTimeStampRadio.set(message_t* msg, uint32_t value)
{
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)
{
return call PacketTimeStampRadio.isValid(msg);
}
async command uint32_t PacketTimeStampMilli.timestamp(message_t* msg)
{
int32_t offset = call PacketTimeStampRadio.timestamp(msg) - call LocalTimeRadio.get();
return (offset >> RADIO_ALARM_MILLI_EXP) + call LocalTimeMilli.get();
}
async command void PacketTimeStampMilli.clear(message_t* msg)
{
call PacketTimeStampRadio.clear(msg);
}
async command void PacketTimeStampMilli.set(message_t* msg, uint32_t value)
{
int32_t offset = (value - call LocalTimeMilli.get()) << RADIO_ALARM_MILLI_EXP;
call PacketTimeStampRadio.set(msg, offset + call LocalTimeRadio.get());
}
}
Index: DummyLayerC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/rf2xx/layers/DummyLayerC.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** DummyLayerC.nc 10 Mar 2009 20:37:58 -0000 1.1
--- DummyLayerC.nc 2 Apr 2009 22:09:59 -0000 1.2
***************
*** 29,33 ****
interface Send;
interface Receive;
- interface LowPowerListening;
interface RadioState;
--- 29,32 ----
***************
*** 65,70 ****
Config = UnconnectedConfig;
-
- components DummyLayerP;
- LowPowerListening = DummyLayerP.LowPowerListening;
}
--- 64,66 ----
Index: IEEE154NetworkLayerC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/rf2xx/layers/IEEE154NetworkLayerC.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** IEEE154NetworkLayerC.nc 29 Mar 2009 21:12:06 -0000 1.2
--- IEEE154NetworkLayerC.nc 2 Apr 2009 22:10:02 -0000 1.3
***************
*** 40,44 ****
implementation
{
! components IEEE154NetworkLayerP, IEEE154Packet2C;
SplitControl = SubControl;
--- 40,44 ----
implementation
{
! components IEEE154NetworkLayerP, IEEE154PacketLayerC;
SplitControl = SubControl;
***************
*** 50,53 ****
SubReceive = IEEE154NetworkLayerP;
! IEEE154NetworkLayerP.IEEE154Packet2 -> IEEE154Packet2C;
}
--- 50,53 ----
SubReceive = IEEE154NetworkLayerP;
! IEEE154NetworkLayerP.IEEE154PacketLayer -> IEEE154PacketLayerC;
}
Index: IEEE154NetworkLayerP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/rf2xx/layers/IEEE154NetworkLayerP.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** IEEE154NetworkLayerP.nc 29 Mar 2009 21:12:06 -0000 1.2
--- IEEE154NetworkLayerP.nc 2 Apr 2009 22:10:03 -0000 1.3
***************
*** 36,40 ****
interface Receive as SubReceive;
! interface IEEE154Packet2;
}
}
--- 36,40 ----
interface Receive as SubReceive;
! interface IEEE154PacketLayer;
}
}
***************
*** 48,52 ****
command error_t Send.send(message_t* msg, uint8_t len)
{
! call IEEE154Packet2.set6LowPan(msg, TINYOS_6LOWPAN_NETWORK_ID);
return call SubSend.send(msg, len);
}
--- 48,52 ----
command error_t Send.send(message_t* msg, uint8_t len)
{
! call IEEE154PacketLayer.set6LowPan(msg, 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 IEEE154Packet2.get6LowPan(msg);
if( network == TINYOS_6LOWPAN_NETWORK_ID )
return signal Receive.receive(msg, payload, len);
--- 74,78 ----
event message_t *SubReceive.receive(message_t *msg, void *payload, uint8_t len)
{
! uint8_t network = call IEEE154PacketLayer.get6LowPan(msg);
if( network == TINYOS_6LOWPAN_NETWORK_ID )
return signal Receive.receive(msg, payload, len);
Index: LowPowerListeningLayerC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/rf2xx/layers/LowPowerListeningLayerC.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** LowPowerListeningLayerC.nc 30 Mar 2009 21:20:15 -0000 1.2
--- LowPowerListeningLayerC.nc 2 Apr 2009 22:10:03 -0000 1.3
***************
*** 22,25 ****
--- 22,27 ----
*/
+ #include <LowPowerListeningLayer.h>
+
#warning "*** USING LOW POWER LISTENING LAYER"
***************
*** 40,45 ****
interface Receive as SubReceive;
! interface PacketField<uint16_t> as PacketSleepInterval;
! interface IEEE154Packet2;
interface PacketAcknowledgements;
}
--- 42,47 ----
interface Receive as SubReceive;
! interface PacketData<lpl_metadata_t> as PacketLplMetadata;
! interface IEEE154PacketLayer;
interface PacketAcknowledgements;
}
***************
*** 58,63 ****
SubSend = LowPowerListeningLayerP;
SubReceive = LowPowerListeningLayerP;
! PacketSleepInterval = LowPowerListeningLayerP;
! IEEE154Packet2 = LowPowerListeningLayerP;
PacketAcknowledgements = LowPowerListeningLayerP;
--- 60,65 ----
SubSend = LowPowerListeningLayerP;
SubReceive = LowPowerListeningLayerP;
! PacketLplMetadata = LowPowerListeningLayerP;
! IEEE154PacketLayer = LowPowerListeningLayerP;
PacketAcknowledgements = LowPowerListeningLayerP;
Index: LowPowerListeningLayerP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/rf2xx/layers/LowPowerListeningLayerP.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** LowPowerListeningLayerP.nc 30 Mar 2009 21:20:15 -0000 1.2
--- LowPowerListeningLayerP.nc 2 Apr 2009 22:10:04 -0000 1.3
***************
*** 23,26 ****
--- 23,27 ----
#include <RadioAssert.h>
+ #include <LowPowerListeningLayer.h>
module LowPowerListeningLayerP
***************
*** 41,46 ****
interface Receive as SubReceive;
! interface PacketField<uint16_t> as PacketSleepInterval;
! interface IEEE154Packet2;
interface PacketAcknowledgements;
interface Timer<TMilli>;
--- 42,47 ----
interface Receive as SubReceive;
! interface PacketData<lpl_metadata_t> as PacketLplMetadata;
! interface IEEE154PacketLayer;
interface PacketAcknowledgements;
interface Timer<TMilli>;
***************
*** 78,97 ****
OFF = 0,
OFF_SUBSTOP = 1, // must have consecutive indices
! OFF_SUBSTOP_DONE = 2, // must have consecutive indices
OFF_STOP_END = 3, // must have consecutive indices
OFF_START_END = 4,
! LISTEN_SUBSTART = 5, // must have consecutive indices
! LISTEN_SUBSTART_DONE = 6, // must have consecutive indices
LISTEN_TIMER = 7, // must have consecutive indices
! LISTEN = 8, // must have consecutive indices
SLEEP_SUBSTOP = 9, // must have consecutive indices
! SLEEP_SUBSTOP_DONE = 10, // must have consecutive indices
SLEEP_TIMER = 11, // must have consecutive indices
! SLEEP = 12, // must have consecutive indices
SEND_SUBSTART = 13, // must have consecutive indices
! SEND_SUBSTART_DONE = 14, // must have consecutive indices
SEND_TIMER = 15, // must have consecutive indices
SEND_SUBSEND= 16,
--- 79,98 ----
OFF = 0,
OFF_SUBSTOP = 1, // must have consecutive indices
! OFF_SUBSTOP_DONE = 2, // must have consecutive indices
OFF_STOP_END = 3, // must have consecutive indices
OFF_START_END = 4,
! LISTEN_SUBSTART = 5, // must have consecutive indices
! LISTEN_SUBSTART_DONE = 6, // must have consecutive indices
LISTEN_TIMER = 7, // must have consecutive indices
! LISTEN = 8, // must have consecutive indices
SLEEP_SUBSTOP = 9, // must have consecutive indices
! SLEEP_SUBSTOP_DONE = 10, // must have consecutive indices
SLEEP_TIMER = 11, // must have consecutive indices
! SLEEP = 12, // must have consecutive indices
SEND_SUBSTART = 13, // must have consecutive indices
! SEND_SUBSTART_DONE = 14, // must have consecutive indices
SEND_TIMER = 15, // must have consecutive indices
SEND_SUBSEND= 16,
***************
*** 336,340 ****
|| call LowPowerListening.getRxSleepInterval(msg) == 0
|| state == SEND_SUBSEND_DONE_LAST
! || (call IEEE154Packet2.getAckRequired(msg) && call PacketAcknowledgements.wasAcked(msg)) )
{
call Timer.stop();
--- 337,341 ----
|| call LowPowerListening.getRxSleepInterval(msg) == 0
|| state == SEND_SUBSEND_DONE_LAST
! || (call IEEE154PacketLayer.getAckRequired(msg) && call PacketAcknowledgements.wasAcked(msg)) )
{
call Timer.stop();
***************
*** 380,384 ****
command void LowPowerListening.setLocalSleepInterval(uint16_t interval)
! {
if( interval < MIN_SLEEP )
interval = 0;
--- 381,385 ----
command void LowPowerListening.setLocalSleepInterval(uint16_t interval)
! {
if( interval < MIN_SLEEP )
interval = 0;
***************
*** 397,401 ****
command uint16_t LowPowerListening.getLocalSleepInterval()
! {
return sleepInterval;
}
--- 398,402 ----
command uint16_t LowPowerListening.getLocalSleepInterval()
! {
return sleepInterval;
}
***************
*** 419,435 ****
interval = MAX_SLEEP;
! call PacketSleepInterval.set(msg, interval);
}
command uint16_t LowPowerListening.getRxSleepInterval(message_t *msg)
! {
! if( ! call PacketSleepInterval.isSet(msg) )
! return sleepInterval;
! return call PacketSleepInterval.get(msg);
}
command void LowPowerListening.setRxDutyCycle(message_t *msg, uint16_t dutyCycle)
! {
call LowPowerListening.setRxSleepInterval(msg,
call LowPowerListening.dutyCycleToSleepInterval(dutyCycle));
--- 420,435 ----
interval = MAX_SLEEP;
! (call PacketLplMetadata.get(msg))->sleepint = interval;
}
command uint16_t LowPowerListening.getRxSleepInterval(message_t *msg)
! {
! uint16_t sleepint = (call PacketLplMetadata.get(msg))->sleepint;
! return sleepint != 0 ? sleepint : sleepInterval;
}
command void LowPowerListening.setRxDutyCycle(message_t *msg, uint16_t dutyCycle)
! {
call LowPowerListening.setRxSleepInterval(msg,
call LowPowerListening.dutyCycleToSleepInterval(dutyCycle));
***************
*** 437,443 ****
command uint16_t LowPowerListening.getRxDutyCycle(message_t *msg)
! {
return call LowPowerListening.sleepIntervalToDutyCycle(
call LowPowerListening.getRxSleepInterval(msg));
}
}
--- 437,448 ----
command uint16_t LowPowerListening.getRxDutyCycle(message_t *msg)
! {
return call LowPowerListening.sleepIntervalToDutyCycle(
call LowPowerListening.getRxSleepInterval(msg));
}
+
+ async event void PacketLplMetadata.clear(message_t* msg)
+ {
+ (call PacketLplMetadata.get(msg))->sleepint = 0;
+ }
}
Index: PacketLinkLayer.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/rf2xx/layers/PacketLinkLayer.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** PacketLinkLayer.h 30 Mar 2009 22:29:48 -0000 1.1
--- PacketLinkLayer.h 2 Apr 2009 22:10:04 -0000 1.2
***************
*** 25,33 ****
#define __PACKETLINKLAYER_H__
! typedef struct packet_link_metadata_t
{
! nx_uint16_t maxRetries;
! nx_uint16_t retryDelay;
! } packet_link_metadata_t;
#endif//__PACKETLINKLAYER_H__
--- 25,33 ----
#define __PACKETLINKLAYER_H__
! typedef struct link_metadata_t
{
! uint16_t maxRetries;
! uint16_t retryDelay;
! } link_metadata_t;
#endif//__PACKETLINKLAYER_H__
Index: PacketLinkLayerC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/rf2xx/layers/PacketLinkLayerC.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** PacketLinkLayerC.nc 30 Mar 2009 22:29:48 -0000 1.1
--- PacketLinkLayerC.nc 2 Apr 2009 22:10:04 -0000 1.2
***************
*** 70,74 ****
uses {
interface Send as SubSend;
! interface PacketData<packet_link_metadata_t>;
interface PacketAcknowledgements;
}
--- 70,74 ----
uses {
interface Send as SubSend;
! interface PacketData<link_metadata_t> as PacketLinkMetadata;
interface PacketAcknowledgements;
}
***************
*** 76,82 ****
implementation {
! components PacketLinkLayerP,
! RF230PacketC,
! new TimerMilliC() as DelayTimerC;
PacketLink = PacketLinkLayerP;
--- 76,80 ----
implementation {
! components PacketLinkLayerP, new TimerMilliC() as DelayTimerC;
PacketLink = PacketLinkLayerP;
***************
*** 84,89 ****
SubSend = PacketLinkLayerP.SubSend;
PacketAcknowledgements = PacketLinkLayerP;
! PacketData = PacketLinkLayerP;
!
PacketLinkLayerP.DelayTimer -> DelayTimerC;
}
--- 82,87 ----
SubSend = PacketLinkLayerP.SubSend;
PacketAcknowledgements = PacketLinkLayerP;
! PacketLinkMetadata = PacketLinkLayerP;
!
PacketLinkLayerP.DelayTimer -> DelayTimerC;
}
Index: PacketLinkLayerP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/rf2xx/layers/PacketLinkLayerP.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** PacketLinkLayerP.nc 30 Mar 2009 22:29:48 -0000 1.1
--- PacketLinkLayerP.nc 2 Apr 2009 22:10:04 -0000 1.2
***************
*** 70,74 ****
interface PacketAcknowledgements;
interface Timer<TMilli> as DelayTimer;
! interface PacketData<packet_link_metadata_t>;
}
}
--- 70,74 ----
interface PacketAcknowledgements;
interface Timer<TMilli> as DelayTimer;
! interface PacketData<link_metadata_t> as PacketLinkMetadata;
}
}
***************
*** 100,104 ****
*/
command void PacketLink.setRetries(message_t *msg, uint16_t maxRetries) {
! (call PacketData.getData(msg))->maxRetries = maxRetries;
}
--- 100,104 ----
*/
command void PacketLink.setRetries(message_t *msg, uint16_t maxRetries) {
! (call PacketLinkMetadata.get(msg))->maxRetries = maxRetries;
}
***************
*** 109,113 ****
*/
command void PacketLink.setRetryDelay(message_t *msg, uint16_t retryDelay) {
! (call PacketData.getData(msg))->retryDelay = retryDelay;
}
--- 109,113 ----
*/
command void PacketLink.setRetryDelay(message_t *msg, uint16_t retryDelay) {
! (call PacketLinkMetadata.get(msg))->retryDelay = retryDelay;
}
***************
*** 116,120 ****
*/
command uint16_t PacketLink.getRetries(message_t *msg) {
! return (call PacketData.getData(msg))->maxRetries;
}
--- 116,120 ----
*/
command uint16_t PacketLink.getRetries(message_t *msg) {
! return (call PacketLinkMetadata.get(msg))->maxRetries;
}
***************
*** 123,127 ****
*/
command uint16_t PacketLink.getRetryDelay(message_t *msg) {
! return (call PacketData.getData(msg))->retryDelay;
}
--- 123,127 ----
*/
command uint16_t PacketLink.getRetryDelay(message_t *msg) {
! return (call PacketLinkMetadata.get(msg))->retryDelay;
}
***************
*** 133,138 ****
}
! async event void PacketData.clear(packet_link_metadata_t* data) {
! data->maxRetries = 0;
}
--- 133,138 ----
}
! async event void PacketLinkMetadata.clear(message_t* msg) {
! (call PacketLinkMetadata.get(msg))->maxRetries = 0;
}
Index: SoftwareAckConfig.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/rf2xx/layers/SoftwareAckConfig.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** SoftwareAckConfig.nc 10 Mar 2009 20:37:58 -0000 1.1
--- SoftwareAckConfig.nc 2 Apr 2009 22:10:04 -0000 1.2
***************
*** 33,36 ****
--- 33,42 ----
/**
+ * Sets the flag in the message indicating to the receiver whether
+ * the message should be acknowledged.
+ */
+ async command void setAckRequired(message_t* msg, bool ack);
+
+ /**
* Returns TRUE if the layer should wait for a software acknowledgement
* to be received after this packet was transmitted.
***************
*** 39,47 ****
/**
- * Sets for the transmitted message whether it was acknowledged or not.
- */
- async command void setAckReceived(message_t* msg, bool acked);
-
- /**
* Returns TRUE if the received packet is an acknowledgement packet.
* The AckedSend layer will filter out all received acknowledgement
--- 45,48 ----
Index: SoftwareAckLayerC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/rf2xx/layers/SoftwareAckLayerC.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** SoftwareAckLayerC.nc 10 Mar 2009 20:37:58 -0000 1.1
--- SoftwareAckLayerC.nc 2 Apr 2009 22:10:04 -0000 1.2
***************
*** 28,31 ****
--- 28,32 ----
interface RadioSend;
interface RadioReceive;
+ interface PacketAcknowledgements;
}
uses
***************
*** 40,44 ****
implementation
{
! components SoftwareAckLayerP, RadioAlarmC;
RadioSend = SoftwareAckLayerP;
--- 41,45 ----
implementation
{
! components SoftwareAckLayerP, RadioAlarmC, new MetadataFlagC();
RadioSend = SoftwareAckLayerP;
***************
*** 47,51 ****
--- 48,54 ----
SubReceive = SoftwareAckLayerP;
Config = SoftwareAckLayerP;
+ PacketAcknowledgements = SoftwareAckLayerP;
SoftwareAckLayerP.RadioAlarm -> RadioAlarmC.RadioAlarm[unique("RadioAlarm")];
+ SoftwareAckLayerP.AckReceivedFlag -> MetadataFlagC;
}
Index: SoftwareAckLayerP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/rf2xx/layers/SoftwareAckLayerP.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** SoftwareAckLayerP.nc 10 Mar 2009 20:37:58 -0000 1.1
--- SoftwareAckLayerP.nc 2 Apr 2009 22:10:04 -0000 1.2
***************
*** 31,34 ****
--- 31,35 ----
interface RadioSend;
interface RadioReceive;
+ interface PacketAcknowledgements;
}
uses
***************
*** 39,42 ****
--- 40,44 ----
interface SoftwareAckConfig;
+ interface PacketFlag as AckReceivedFlag;
}
}
***************
*** 70,74 ****
if( (error = call SubSend.send(msg)) == SUCCESS )
{
! call SoftwareAckConfig.setAckReceived(msg, FALSE);
state = STATE_DATA_SEND;
txMsg = msg;
--- 72,76 ----
if( (error = call SubSend.send(msg)) == SUCCESS )
{
! call AckReceivedFlag.clear(msg);
state = STATE_DATA_SEND;
txMsg = msg;
***************
*** 137,141 ****
call RadioAlarm.cancel();
! call SoftwareAckConfig.setAckReceived(txMsg, ack);
state = STATE_READY;
--- 139,143 ----
call RadioAlarm.cancel();
! call AckReceivedFlag.setValue(txMsg, ack);
state = STATE_READY;
***************
*** 159,161 ****
--- 161,186 ----
return signal RadioReceive.receive(msg);
}
+
+ /*----------------- PacketAcknowledgements -----------------*/
+
+ async command error_t PacketAcknowledgements.requestAck(message_t* msg)
+ {
+ call SoftwareAckConfig.setAckRequired(msg, TRUE);
+
+ return SUCCESS;
+ }
+
+ async command error_t PacketAcknowledgements.noAck(message_t* msg)
+ {
+ call SoftwareAckConfig.setAckRequired(msg, FALSE);
+
+ return SUCCESS;
+ }
+
+ async command bool PacketAcknowledgements.wasAcked(message_t* msg)
+ {
+ return call AckReceivedFlag.get(msg);
+ }
+
+
}
--- DummyLayerP.nc DELETED ---
- Previous message: [Tinyos-2-commits] CVS: tinyos-2.x/tos/lib/mac/tkn154 DispatchSlottedCsmaP.nc, 1.2, 1.3 DispatchUnslottedCsmaP.nc, 1.3, 1.4 README.txt, 1.5, 1.6
- Next message: [Tinyos-2-commits] CVS: tinyos-2.x/tos/chips/rf2xx/rf212 RF212ActiveMessage.h, NONE, 1.1 RF212DriverLayer.h, NONE, 1.1 RF212ActiveMessageC.nc, 1.3, 1.4 RF212ActiveMessageP.nc, 1.3, 1.4 RF212DriverLayerC.nc, 1.1, 1.2 RF212DriverLayerP.nc, 1.2, 1.3 RF212.h, 1.1, NONE RF212Packet.h, 1.3, NONE RF212PacketC.nc, 1.3, NONE RF212PacketP.nc, 1.3, NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Tinyos-2-commits
mailing list