[Tinyos-2-commits] CVS: tinyos-2.x/tos/chips/rf230 RadioConfig.nc, NONE, 1.1 MessageBufferLayerC.nc, 1.1, 1.2 MessageBufferLayerP.nc, 1.3, 1.4 RF230ActiveMessageC.nc, 1.5, 1.6
Miklos Maroti
mmaroti at users.sourceforge.net
Tue Jan 27 12:17:54 PST 2009
Update of /cvsroot/tinyos/tinyos-2.x/tos/chips/rf230
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv8340
Modified Files:
MessageBufferLayerC.nc MessageBufferLayerP.nc
RF230ActiveMessageC.nc
Added Files:
RadioConfig.nc
Log Message:
export a setChannel command to applications
--- NEW FILE: RadioConfig.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
*/
interface RadioConfig
{
/**
* Sets the current channel. Returns EBUSY if the stack is unable
* to change the channel this time (some other operation is in progress),
* EALREADY if the selected channel is already set, SUCCESS otherwise.
*/
command error_t setChannel(uint8_t channel);
/**
* This event is signaled exactly once for each sucessfully posted state
* setChannel command when it is completed.
*/
event void setChannelDone();
}
Index: MessageBufferLayerC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/rf230/MessageBufferLayerC.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** MessageBufferLayerC.nc 5 Nov 2007 20:36:48 -0000 1.1
--- MessageBufferLayerC.nc 27 Jan 2009 20:17:51 -0000 1.2
***************
*** 29,32 ****
--- 29,33 ----
interface Send;
interface Receive;
+ interface RadioConfig;
}
uses
***************
*** 48,52 ****
SplitControl = MessageBufferLayerP;
Send = MessageBufferLayerP;
! Receive = MessageBufferLayerP.Receive;
RadioState = MessageBufferLayerP;
--- 49,54 ----
SplitControl = MessageBufferLayerP;
Send = MessageBufferLayerP;
! Receive = MessageBufferLayerP;
! RadioConfig = MessageBufferLayerP;
RadioState = MessageBufferLayerP;
Index: MessageBufferLayerP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/rf230/MessageBufferLayerP.nc,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** MessageBufferLayerP.nc 21 Apr 2008 20:58:08 -0000 1.3
--- MessageBufferLayerP.nc 27 Jan 2009 20:17:51 -0000 1.4
***************
*** 34,37 ****
--- 34,38 ----
interface Send;
interface Receive;
+ interface RadioConfig;
}
uses
***************
*** 59,62 ****
--- 60,64 ----
STATE_TURN_ON = 4,
STATE_TURN_OFF = 5,
+ STATE_CHANNEL = 6,
};
***************
*** 99,102 ****
--- 101,123 ----
}
+ command error_t RadioConfig.setChannel(uint8_t channel)
+ {
+ error_t error;
+
+ call Tasklet.suspend();
+
+ if( state != STATE_READY )
+ error = EBUSY;
+ else
+ error = call RadioState.setChannel(channel);
+
+ if( error == SUCCESS )
+ state = STATE_CHANNEL;
+
+ call Tasklet.resume();
+
+ return error;
+ }
+
task void stateDoneTask()
{
***************
*** 106,116 ****
// change the state before so we can be reentered from the event
! if( s == STATE_TURN_ON || s == STATE_TURN_OFF )
! state = STATE_READY;
if( s == STATE_TURN_ON )
signal SplitControl.startDone(SUCCESS);
! else
signal SplitControl.stopDone(SUCCESS);
}
--- 127,140 ----
// change the state before so we can be reentered from the event
! state = STATE_READY;
if( s == STATE_TURN_ON )
signal SplitControl.startDone(SUCCESS);
! else if( s == STATE_TURN_OFF )
signal SplitControl.stopDone(SUCCESS);
+ else if( s == STATE_CHANNEL )
+ signal RadioConfig.setChannelDone();
+ else // not our event, ignore it
+ state = s;
}
***************
*** 128,131 ****
--- 152,159 ----
}
+ default event void RadioConfig.setChannelDone()
+ {
+ }
+
/*----------------- Send -----------------*/
Index: RF230ActiveMessageC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/rf230/RF230ActiveMessageC.nc,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** RF230ActiveMessageC.nc 22 Jan 2009 20:04:37 -0000 1.5
--- RF230ActiveMessageC.nc 27 Jan 2009 20:17:51 -0000 1.6
***************
*** 38,41 ****
--- 38,42 ----
interface PacketAcknowledgements;
interface LowPowerListening;
+ interface RadioConfig;
interface PacketField<uint8_t> as PacketLinkQuality;
***************
*** 69,72 ****
--- 70,74 ----
PacketTimeStampMilli = RF230PacketC;
LowPowerListening = LowPowerListeningLayerC;
+ RadioConfig = MessageBufferLayerC;
components ActiveMessageLayerC;
More information about the Tinyos-2-commits
mailing list