[Tinyos-2-commits] CVS: tinyos-2.x/tos/chips/cc2420/link
PacketLinkC.nc, NONE, 1.1 PacketLinkDummyC.nc, NONE,
1.1 PacketLinkDummyP.nc, NONE, 1.1 PacketLinkP.nc, NONE,
1.1 readme.txt, NONE, 1.1
dmm
rincon at users.sourceforge.net
Tue Jul 3 17:37:17 PDT 2007
- Previous message: [Tinyos-2-commits] CVS: tinyos-2.x/tos/chips/cc2420/interfaces
CC2420Config.nc, NONE, 1.1 CC2420Fifo.nc, NONE,
1.1 CC2420Packet.nc, NONE, 1.1 CC2420PacketBody.nc, NONE,
1.1 CC2420Power.nc, NONE, 1.1 CC2420Ram.nc, NONE,
1.1 CC2420Receive.nc, NONE, 1.1 CC2420Register.nc, NONE,
1.1 CC2420Strobe.nc, NONE, 1.1 CC2420Transmit.nc, NONE,
1.1 ChipSpiResource.nc, NONE, 1.1 PowerCycle.nc, NONE,
1.1 RadioBackoff.nc, NONE, 1.1 ReceiveIndicator.nc, NONE, 1.1
- Next message: [Tinyos-2-commits] CVS: tinyos-2.x/tos/chips/cc2420/lowpan
CC2420TinyosNetworkC.nc, NONE, 1.1 CC2420TinyosNetworkP.nc,
NONE, 1.1 readme.txt, NONE, 1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/tinyos/tinyos-2.x/tos/chips/cc2420/link
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv30635/link
Added Files:
PacketLinkC.nc PacketLinkDummyC.nc PacketLinkDummyP.nc
PacketLinkP.nc readme.txt
Log Message:
New CC2420 architecture in place for 2.0.2 release. See the README.txt file for changes. Test results from TUnit testing are included.
--- NEW FILE: PacketLinkC.nc ---
/*
* Copyright (c) 2005-2006 Rincon Research Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
* - Neither the name of the Rincon Research Corporation nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* RINCON RESEARCH OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE
*/
/**
* Reliable Packet Link Functionality
* @author David Moss
* @author Jon Wyant
*/
#warning "*** USING PACKET LINK LAYER"
configuration PacketLinkC {
provides {
interface Send;
interface PacketLink;
}
uses {
interface Send as SubSend;
}
}
implementation {
components PacketLinkP,
ActiveMessageC,
CC2420PacketC,
RandomC,
new StateC() as SendStateC,
new TimerMilliC() as DelayTimerC;
PacketLink = PacketLinkP;
Send = PacketLinkP.Send;
SubSend = PacketLinkP.SubSend;
PacketLinkP.SendState -> SendStateC;
PacketLinkP.DelayTimer -> DelayTimerC;
PacketLinkP.PacketAcknowledgements -> ActiveMessageC;
PacketLinkP.AMPacket -> ActiveMessageC;
PacketLinkP.CC2420PacketBody -> CC2420PacketC;
}
--- NEW FILE: PacketLinkDummyC.nc ---
/*
* Copyright (c) 2005-2006 Rincon Research Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
* - Neither the name of the Rincon Research Corporation nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* RINCON RESEARCH OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE
*/
/**
* Dummy configuration for PacketLink Layer
* @author David Moss
* @author Jon Wyant
*/
configuration PacketLinkDummyC {
provides {
interface Send;
interface PacketLink;
}
uses {
interface Send as SubSend;
}
}
implementation {
components PacketLinkDummyP,
ActiveMessageC;
PacketLink = PacketLinkDummyP;
Send = SubSend;
PacketLinkDummyP.PacketAcknowledgements -> ActiveMessageC;
}
--- NEW FILE: PacketLinkDummyP.nc ---
/*
* Copyright (c) 2005-2006 Rincon Research Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
* - Neither the name of the Rincon Research Corporation nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* RINCON RESEARCH OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE
*/
/**
* Dummy module for Packet Link layer
* @author David Moss
* @author Jon Wyant
*/
module PacketLinkDummyP {
provides {
interface PacketLink;
}
uses {
interface PacketAcknowledgements;
}
}
implementation {
/***************** PacketLink Commands ***************/
/**
* Set the maximum number of times attempt message delivery
* Default is 0
* @param msg
* @param maxRetries the maximum number of attempts to deliver
* the message
*/
command void PacketLink.setRetries(message_t *msg, uint16_t maxRetries) {
}
/**
* Set a delay between each retry attempt
* @param msg
* @param retryDelay the delay betweeen retry attempts, in milliseconds
*/
command void PacketLink.setRetryDelay(message_t *msg, uint16_t retryDelay) {
}
/**
* @return the maximum number of retry attempts for this message
*/
command uint16_t PacketLink.getRetries(message_t *msg) {
return 0;
}
/**
* @return the delay between retry attempts in ms for this message
*/
command uint16_t PacketLink.getRetryDelay(message_t *msg) {
return 0;
}
/**
* @return TRUE if the message was delivered.
* This should always be TRUE if the message was sent to the
* AM_BROADCAST_ADDR
*/
command bool PacketLink.wasDelivered(message_t *msg) {
return call PacketAcknowledgements.wasAcked(msg);
}
}
--- NEW FILE: PacketLinkP.nc ---
/*
* Copyright (c) 2005-2006 Rincon Research Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
* - Neither the name of the Rincon Research Corporation nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* RINCON RESEARCH OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE
*/
/**
* Reliable Packet Link Functionality
* @author David Moss
* @author Jon Wyant
*/
#include "CC2420.h"
module PacketLinkP {
provides {
interface Send;
interface PacketLink;
}
uses {
interface Send as SubSend;
interface State as SendState;
interface PacketAcknowledgements;
interface Timer<TMilli> as DelayTimer;
interface AMPacket;
interface CC2420PacketBody;
}
}
implementation {
/** The message currently being sent */
message_t *currentSendMsg;
/** Length of the current send message */
uint8_t currentSendLen;
/** The length of the current send message */
uint16_t totalRetries;
/**
* Send States
*/
enum {
S_IDLE,
S_SENDING,
};
/***************** Prototypes ***************/
task void send();
void signalDone(error_t error);
/***************** PacketLink Commands ***************/
/**
* Set the maximum number of times attempt message delivery
* Default is 0
* @param msg
* @param maxRetries the maximum number of attempts to deliver
* the message
*/
command void PacketLink.setRetries(message_t *msg, uint16_t maxRetries) {
(call CC2420PacketBody.getMetadata(msg))->maxRetries = maxRetries;
}
/**
* Set a delay between each retry attempt
* @param msg
* @param retryDelay the delay betweeen retry attempts, in milliseconds
*/
command void PacketLink.setRetryDelay(message_t *msg, uint16_t retryDelay) {
(call CC2420PacketBody.getMetadata(msg))->retryDelay = retryDelay;
}
/**
* @return the maximum number of retry attempts for this message
*/
command uint16_t PacketLink.getRetries(message_t *msg) {
return (call CC2420PacketBody.getMetadata(msg))->maxRetries;
}
/**
* @return the delay between retry attempts in ms for this message
*/
command uint16_t PacketLink.getRetryDelay(message_t *msg) {
return (call CC2420PacketBody.getMetadata(msg))->retryDelay;
}
/**
* @return TRUE if the message was delivered.
*/
command bool PacketLink.wasDelivered(message_t *msg) {
return call PacketAcknowledgements.wasAcked(msg);
}
/***************** Send Commands ***************/
/**
* Each call to this send command gives the message a single
* DSN that does not change for every copy of the message
* sent out. For messages that are not acknowledged, such as
* a broadcast address message, the receiving end does not
* signal receive() more than once for that message.
*/
command error_t Send.send(message_t *msg, uint8_t len) {
error_t error;
if(call SendState.requestState(S_SENDING) == SUCCESS) {
currentSendMsg = msg;
currentSendLen = len;
totalRetries = 0;
if(call PacketLink.getRetries(msg) > 0) {
call PacketAcknowledgements.requestAck(msg);
}
if((error = call SubSend.send(msg, len)) != SUCCESS) {
call SendState.toIdle();
}
return error;
}
return EBUSY;
}
command error_t Send.cancel(message_t *msg) {
if(currentSendMsg == msg) {
call SendState.toIdle();
return call SubSend.cancel(msg);
}
return FAIL;
}
command uint8_t Send.maxPayloadLength() {
return call SubSend.maxPayloadLength();
}
command void *Send.getPayload(message_t* msg) {
return call SubSend.getPayload(msg);
}
/***************** SubSend Events ***************/
event void SubSend.sendDone(message_t* msg, error_t error) {
if(call SendState.getState() == S_SENDING) {
totalRetries++;
if(call PacketAcknowledgements.wasAcked(msg)) {
signalDone(SUCCESS);
return;
} else if(totalRetries < call PacketLink.getRetries(currentSendMsg)) {
if(call PacketLink.getRetryDelay(currentSendMsg) > 0) {
// Resend after some delay
call DelayTimer.startOneShot(call PacketLink.getRetryDelay(currentSendMsg));
} else {
// Resend immediately
post send();
}
return;
}
}
signalDone(error);
}
/***************** Timer Events ****************/
/**
* When this timer is running, that means we're sending repeating messages
* to a node that is receive check duty cycling.
*/
event void DelayTimer.fired() {
if(call SendState.getState() == S_SENDING) {
post send();
}
}
/***************** Tasks ***************/
task void send() {
if(call PacketLink.getRetries(currentSendMsg) > 0) {
call PacketAcknowledgements.requestAck(currentSendMsg);
}
if(call SubSend.send(currentSendMsg, currentSendLen) != SUCCESS) {
post send();
}
}
/***************** Functions ***************/
void signalDone(error_t error) {
call DelayTimer.stop();
call SendState.toIdle();
signal Send.sendDone(currentSendMsg, error);
}
}
--- NEW FILE: readme.txt ---
PacketLink is used for link-layer retransmissions guided by your own
application requirements. It will fail if it receives false-acknowledgements,
which is completely possible in 802.15.4.
See TEP 127 for more details.
- Previous message: [Tinyos-2-commits] CVS: tinyos-2.x/tos/chips/cc2420/interfaces
CC2420Config.nc, NONE, 1.1 CC2420Fifo.nc, NONE,
1.1 CC2420Packet.nc, NONE, 1.1 CC2420PacketBody.nc, NONE,
1.1 CC2420Power.nc, NONE, 1.1 CC2420Ram.nc, NONE,
1.1 CC2420Receive.nc, NONE, 1.1 CC2420Register.nc, NONE,
1.1 CC2420Strobe.nc, NONE, 1.1 CC2420Transmit.nc, NONE,
1.1 ChipSpiResource.nc, NONE, 1.1 PowerCycle.nc, NONE,
1.1 RadioBackoff.nc, NONE, 1.1 ReceiveIndicator.nc, NONE, 1.1
- Next message: [Tinyos-2-commits] CVS: tinyos-2.x/tos/chips/cc2420/lowpan
CC2420TinyosNetworkC.nc, NONE, 1.1 CC2420TinyosNetworkP.nc,
NONE, 1.1 readme.txt, NONE, 1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Tinyos-2-commits
mailing list