[Tinyos-contrib-commits] CVS: tinyos-1.x/contrib/rincon/tos/lib/CC1000Radio/interfaces Packet.nc, NONE, 1.1 LowPowerListening.nc, NONE, 1.1 RadioCRCPacket.nc, NONE, 1.1 SpiByteFifo.nc, NONE, 1.1 CC1000Squelch.nc, NONE, 1.1 Random.nc, NONE, 1.1 CC1000Control.nc, NONE, 1.1 CsmaBackoff.nc, NONE, 1.1 PacketM.nc, NONE, 1.1 FrequencyManager.nc, NONE, 1.1 RadioTimeStamping.nc, NONE, 1.1 HPLCC1000.nc, NONE, 1.1 PacketAcknowledgements.nc, NONE, 1.1 Rssi.nc, NONE, 1.1 CsmaControl.nc, NONE, 1.1 MacControl.nc, NONE, 1.1 ByteRadio.nc, NONE, 1.1 RadioMode.nc, NONE, 1.1 BusyWait.nc, NONE, 1.1

dmm rincon at users.sourceforge.net
Thu Jul 27 16:39:00 PDT 2006


Update of /cvsroot/tinyos/tinyos-1.x/contrib/rincon/tos/lib/CC1000Radio/interfaces
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv18810/contrib/rincon/tos/lib/CC1000Radio/interfaces

Added Files:
	Packet.nc LowPowerListening.nc RadioCRCPacket.nc 
	SpiByteFifo.nc CC1000Squelch.nc Random.nc CC1000Control.nc 
	CsmaBackoff.nc PacketM.nc FrequencyManager.nc 
	RadioTimeStamping.nc HPLCC1000.nc PacketAcknowledgements.nc 
	Rssi.nc CsmaControl.nc MacControl.nc ByteRadio.nc RadioMode.nc 
	BusyWait.nc 
Log Message:
Added the latest rev. of the CC1000Radio stack, backported from TinyOS 2.0 with modifications.

--- NEW FILE: Packet.nc ---
// $Id: Packet.nc,v 1.1.2.9 2006/01/29 20:32:25 scipio Exp $
/*									tab:4
 * "Copyright (c) 2004-5 The Regents of the University  of California.  
 * 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 UNIVERSITY OF CALIFORNIA 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 UNIVERSITY OF
 * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * 
 * THE UNIVERSITY OF CALIFORNIA 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 UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
 *
 * Copyright (c) 2004-5 Intel Corporation
 * All rights reserved.
 *
 * This file is distributed under the terms in the attached INTEL-LICENSE     
 * file. If you do not find these files, copies can be found by writing to
 * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA, 
 * 94704.  Attention:  Intel License Inquiry.
 */

/** 
  * The basic message data type accessors. Protocols may use
  * additional packet interfaces for their protocol specific
  * data/metadata.
  *
  * @author Philip Levis
  * @author David Moss
  * @date   January 5 2005
  * @see    TEP 116: Packet Protocols
  */ 

interface Packet {


  /**
   * Clear out this packet.  Note that this is a deep operation and
   * total operation: calling clear() on any layer will completely
   * clear the packet for reuse.
   * @param  msg    the packet to clear
   */
  command void clear(TOS_Msg *msg);

  /**
   * Return the length of the payload of msg. This value may be less
   * than what maxPayloadLength() returns, if the packet is smaller than
   * the MTU. If a communication component does not support variably
   * sized data regions, then payloadLength() will always return
   * the same value as maxPayloadLength(). 
   *
   * @param  msg    the packet to examine
   * @return        the length of its current payload
   */
  command uint8_t payloadLength(TOS_Msg *msg);

  /**
   * Set the length field of the packet. This value is not checked
   * for validity (e.g., if it is larger than the maximum payload
   * size). This command is not used when sending packets, as calls
   * to send include a length parameter. Rather, it is used by
   * components, such as queues, that need to buffer requests to
   * send.  This command allows the component to store the length
   * specified in the request and later recover it when actually
   * sending.
   *
   * @param msg   the packet
   * @param len   the value to set its length field to
   */
  command void setPayloadLength(TOS_Msg *msg, uint8_t len);

  /**
   * Return the maximum payload length that this communication layer
   * can provide. Note that, depending on protocol fields, a given
   * request to send a packet may not be able to send the maximum
   * payload length (e.g., if there are variable length
   * fields). Protocols may provide specialized interfaces for these
   * circumstances.
   *
   * @return   the maximum size payload allowed by this layer
   */
  command uint8_t maxPayloadLength();

  /**
   * Return a pointer to a protocol's payload region in a packet.  If
   * len is not NULL, getPayload will return the length of the payload
   * in it, which is the same as the return value from
   * payloadLength(). If a protocol does not support variable length
   * packets, then *len is equal to maxPayloadLength().
   *
   * @param msg   the packet
   * @param len   pointer to where the current payload length should be stored.
   * @return      a pointer to the packet's data payload for this layer
   */
  command void *getPayload(TOS_Msg *msg, uint8_t *len);

}

--- NEW FILE: LowPowerListening.nc ---

/**
 * Low Power Listening control interface
 * 
 * @author Joe Polastre
 * @author David Moss
 */
interface LowPowerListening
{
  /**
   * Set the current Low Power Listening mode.
   * Setting the LPL mode sets both the check interval and preamble length.
   * The listening mode can only be set while the radio is stopped.
   *
   * Modes include:
   *  0 = Radio fully on
   *  1 = 10ms check interval
   *  2 = 25ms check interval
   *  3 = 50ms check interval
   *  4 = 100ms check interval (recommended)
   *  5 = 200ms check interval
   *  6 = 400ms check interval
   *  7 = 800ms check interval
   *  8 = 1600ms check interval
   *
   * @param mode the mode number
   * @return SUCCESS if the mode was successfully changed, FAIL otherwise
   */
  async command result_t setListeningMode(uint8_t mode);

  /**
   * Get the current Low Power Listening mode
   * @return mode number (see SetListeningMode)
   */
  async command uint8_t getListeningMode();

  /**
   * Set the transmit mode.  This allows for hybrid schemes where
   * the transmit mode is different than the receive mode.
   * Use SetListeningMode first, then change the mode with SetTransmitMode.
   *
   * @param mode mode number (see SetListeningMode)
   * @return SUCCESS if the mode was successfully changed, FAIL otherwise
   */
  async command result_t setTransmitMode(uint8_t mode);

  /**
   * Get the current Low Power Listening transmit mode
   * @return mode number (see SetListeningMode)
   */
  async command uint8_t getTransmitMode();

  /**
   * Set the preamble length of outgoing packets. Note that this overrides
   * the value set by setListeningMode or setTransmitMode.
   *
   * @param bytes length of the preamble in bytes
   * @return SUCCESS if the preamble length was successfully changed, FAIL
   *   otherwise
   */
  async command result_t setPreambleLength(uint16_t bytes);

  /**
   * Get the preamble length of outgoing packets
   *
   * @return length of the preamble in bytes
   */
  async command uint16_t getPreambleLength();

  /**
   * Set the check interval (time between waking up and sampling
   * the radio for activity in low power listening). The sleep time
   * can only be changed if low-power-listening is enabled 
   * (setListeningMode called with a non-zero value).
   *
   * @param ms check interval in milliseconds
   * @return SUCCESS if the check interval was successfully changed,
   *   FAIL otherwise.
   */
  async command result_t setCheckInterval(uint16_t ms);

  /**
   * Get the check interval currently used by low power listening
   *
   * @return length of the check interval in milliseconds
   */
  async command uint16_t getCheckInterval();
}

/*
 *
 *
 * "Copyright (c) 2000-2002 The Regents of the University  of California.  
 * 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 UNIVERSITY OF CALIFORNIA 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 UNIVERSITY OF
 * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * 
 * THE UNIVERSITY OF CALIFORNIA 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 UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
 *
 */



--- NEW FILE: RadioCRCPacket.nc ---
// $Id: RadioCRCPacket.nc,v 1.3 2003/10/07 21:46:30 idgay Exp $

/*									tab:4
 * "Copyright (c) 2000-2003 The Regents of the University  of California.  
 * 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 UNIVERSITY OF CALIFORNIA 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 UNIVERSITY OF
 * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * 
 * THE UNIVERSITY OF CALIFORNIA 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 UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
 *
 * Copyright (c) 2002-2003 Intel Corporation
 * All rights reserved.
 *
 * This file is distributed under the terms in the attached INTEL-LICENSE     
 * file. If you do not find these files, copies can be found by writing to
 * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA, 
 * 94704.  Attention:  Intel License Inquiry.
 */
 
/**
 * This configuration connects the application level with
 * the correct radio stack, allowing application platform
 * independance.
 *
 */
configuration RadioCRCPacket {
  provides {
    interface StdControl as Control;
    interface BareSendMsg as Send;
    interface ReceiveMsg as Receive;
  }
}
implementation {
  components CC1000RadioC; 

  Control = CC1000RadioC;
  Send = CC1000RadioC;
  Receive = CC1000RadioC;
}




--- NEW FILE: SpiByteFifo.nc ---
// $Id: SpiByteFifo.nc,v 1.4 2003/10/07 21:46:30 idgay Exp $

/*									tab:4
 * "Copyright (c) 2000-2003 The Regents of the University  of California.  
 * 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 UNIVERSITY OF CALIFORNIA 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 UNIVERSITY OF
 * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * 
 * THE UNIVERSITY OF CALIFORNIA 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 UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
 *
 * Copyright (c) 2002-2003 Intel Corporation
 * All rights reserved.
 *
 * This file is distributed under the terms in the attached INTEL-LICENSE     
 * file. If you do not find these files, copies can be found by writing to
 * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA, 
 * 94704.  Attention:  Intel License Inquiry.
 */
 
interface SpiByteFifo {

  async command result_t writeByte(uint8_t data);
  
  async command result_t isBufBusy();
  
  async command uint8_t readByte();
  
  async command result_t enableIntr();
  
  async command result_t disableIntr();
  
  async command result_t initSlave();
  
  async command result_t txMode();
  
  async command result_t rxMode();

  async event result_t dataReady(uint8_t data);
  
}

--- NEW FILE: CC1000Squelch.nc ---
/* $Id: CC1000Squelch.nc,v 1.1.2.2 2006/01/26 21:11:40 idgay Exp $
 * "Copyright (c) 2000-2005 The Regents of the University  of California.  
 * 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 UNIVERSITY OF CALIFORNIA 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 UNIVERSITY OF
 * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * 
 * THE UNIVERSITY OF CALIFORNIA 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 UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
 *
 * Copyright (c) 2002-2005 Intel Corporation
 * All rights reserved.
 *
 * This file is distributed under the terms in the attached INTEL-LICENSE     
 * file. If you do not find these files, copies can be found by writing to
 * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA, 
 * 94704.  Attention:  Intel License Inquiry.
 */

/**
 * CC1000 internal noise floor (aka squelch value) interface
 * @author David Gay
 */
interface CC1000Squelch {

  /**
   * Adjust noise floor based on new noise measurement
   * @param data noise measurement
   */
  async command void adjust(uint16_t data);

  /**
   * Return current estimated noise floor
   * @return Noise floor value
   */
  async command uint16_t get();

  /**
   * Check if noise floor estimate is considered stable (typically after
   * some number of measurements)
   * @return TRUE if noise floor estimate considered stable, FALSE otherwise
   */
  command bool settled();
}

--- NEW FILE: Random.nc ---
/*
 * "Copyright (c) 2000-2005 The Regents of the University  of California.  
 * 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 UNIVERSITY OF CALIFORNIA 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 UNIVERSITY OF
 * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * 
 * THE UNIVERSITY OF CALIFORNIA 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 UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
 *
 */

/** 
  * Interface for generating 16-bit and 32-bit random numbers.
  *
  * @author Barbara Hohlt
  */ 
interface Random
{
    /** 
     * Produces a 32-bit pseudorandom number. 
     * @return Returns the 32-bit pseudorandom number.
     */
  async command uint32_t rand32();

    /** 
     * Produces a 32-bit pseudorandom number. 
     * @return Returns low 16 bits of the pseudorandom number.
     */
  async command uint16_t rand16();

}

    

--- NEW FILE: CC1000Control.nc ---
/* $Id: CC1000Control.nc,v 1.1.2.5 2006/01/27 18:46:00 idgay Exp $
 * "Copyright (c) 2000-2005 The Regents of the University  of California.  
 * 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 UNIVERSITY OF CALIFORNIA 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 UNIVERSITY OF
 * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * 
 * THE UNIVERSITY OF CALIFORNIA 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 UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
 *
 * Copyright (c) 2002-2005 Intel Corporation
 * All rights reserved.
 *
 * This file is distributed under the terms in the attached INTEL-LICENSE     
 * file. If you do not find these files, copies can be found by writing to
 * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA, 
 * 94704.  Attention:  Intel License Inquiry.
 */
/**
 * CC1000 internal radio control interface.
 * @author Philip Buonadonna
 * @aythor Jaein Jeong
 */
interface CC1000Control
{


  /**
   * Tune the radio to one of the frequencies available in the CC1K_Params
   * table.  Calling Tune will allso reset the rfpower and LockVal
   * selections to the table values.
   * 
   * @param freq The index into the CC1K_Params table that holds the
   * desired preset frequency parameters.
   */
  command void tunePreset(uint8_t freq); 

  /**
   * Tune the radio to a given frequency. Since the CC1000 uses a digital
   * frequency synthesizer, it cannot tune to just an arbitrary frequency.
   * This routine will determine the closest achievable channel, compute
   * the necessary parameters and tune the radio.
   * 
   * @param The desired channel frequency, in Hz.
   * 
   * @return The actual computed channel frequency, in Hz.  A return value
   * of '0' indicates that no frequency was computed and the radio was not
   * tuned.
   */
  command uint32_t tuneManual(uint32_t DesiredFreq);

  /**
   * Set the baud rate to 76.8 kBaud or 38.4 kBaud.
   * The default is 38.4 kBaud, compatible across all motes.
   * If your network does not contain any mica2dot motes, 
   * you should double the baud rate - saving power when communicating
   * by increasing throughput.
   *
   * @param doubleBaud - TRUE to double the default baud rate to 76.8 kBaud,
   *     FALSE to set the baud rate to 38.4 kBaud.
   */
  command void doubleBaudRate(bool doubleBaud);
  
  /** 
   * Auto-Recalibration is on by default.
   *
   * Enable or disable the automatic recalibrations. Temperature and
   * voltage variations will cause the frequency to drift over time.
   * Recalibrating the radio frequencies every few hours will prevent this
   * @param on - TRUE if recalibration should be on, FALSE if it shouldn't
   * @param hours - The delay, in hours, after which to auto recalibrate
   */
  command void setAutoRecalibration(bool on, uint8_t hours);
  
  /**
   * Turn the CC1000 off
   */
  async command void off();

  /**
   * Shift the CC1000 Radio into transmit mode.
   */
  async command void txMode();

  /**
   * Shift the CC1000 Radio in receive mode.
   */
  async command void rxMode();

  /**
   * Turn off the bias power on the CC1000 radio, but leave the core and
   * crystal oscillator powered.  This will result in approximately a 750
   * uA power savings.
   */
  async command void coreOn();			

  /**
   * Turn the bias power on. This function must be followed by a call to
   * either rxMode() or txMode() to place the radio in a recieve/transmit
   * state respectively. There is approximately a 200us delay when
   * restoring bias power.
   */
  async command void biasOn();

  /**
   * Set the transmit RF power value.  The input value is simply an
   * arbitrary index that is programmed into the CC1000 registers.  Consult
   * the CC1000 datasheet for the resulting power output/current
   * consumption values.
   *
   * @param power A power index between 1 and 255.
   */
  command void setRFPower(uint8_t power);	

  /**
   * Get the present RF power index.
   *
   * @return The power index value.
   */
  command uint8_t getRFPower();		

  /** 
   * Select the signal to monitor at the CHP_OUT pin of the CC1000.  See
   * the CC1000 data sheet for the available signals.
   * 
   * @param LockVal The index of the signal to monitor at the CHP_OUT pin
   */
  command void selectLock(uint8_t LockVal); 

  /**
   * Get the binary value from the CHP_OUT pin.  Analog signals cannot be
   * read using function.
   *
   * @return 1 - Pin is high or 0 - Pin is low
   */
  command uint8_t getLock();

}

--- NEW FILE: CsmaBackoff.nc ---
/*									tab:4
 * "Copyright (c) 2000-2005 The Regents of the University  of California.  
 * 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 UNIVERSITY OF CALIFORNIA 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 UNIVERSITY OF
 * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * 
 * THE UNIVERSITY OF CALIFORNIA 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 UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
 *
 */
 
/**
 * Interface for MAC Backoff values from the radio stack.
 * Allows application to change the backoff on a per packet basis.
 * Only used if congestion control is enabled.
 *
 * @author Joe Polastre
 */
interface CsmaBackoff
{
  /**
   * Return initial backoff time before attempting to send message m. The
   * units are radio dependent.
   * @return Initial backoff time
   */
  async event uint16_t initial();

  /**
   * Return backoff time after message m could not be send due to congestion.
   * The units are radio dependent.
   * @return Backoff time after congestion
   */
  async event uint16_t congestion();
}

--- NEW FILE: PacketM.nc ---
/*
 * Copyright (c) 2004-2006 Rincon Research Corporation.  
 * All rights reserved.
 * 
 * Rincon Research will permit distribution and use by others subject to
 * the restrictions of a licensing agreement which contains (among other things)
 * the following restrictions:
 * 
 *  1. No credit will be taken for the Work of others.
 *  2. It will not be resold for a price in excess of reproduction and 
 *      distribution costs.
 *  3. Others are not restricted from copying it or using it except as 
 *      set forward in the licensing agreement.
 *  4. Commented source code of any modifications or additions will be 
 *      made available to Rincon Research on the same terms.
 *  5. This notice will remain intact and displayed prominently.
 * 
 * Copies of the complete licensing agreement may be obtained by contacting 
 * Rincon Research, 101 N. Wilmot, Suite 101, Tucson, AZ 85711.
 * 
 * There is no warranty with this product, either expressed or implied.  
 * Use at your own risk.  Rincon Research is not liable or responsible for 
 * damage or loss incurred or resulting from the use or misuse of this software.
 */

/**
 * This module provides the Packet interface 
 * with default packet information.
 * 
 * The packet interface can be overridden by
 * comm layers higher up in the stack, such as security
 * or bcast.  This allows application components that sit on
 * top to know how much of the payload belongs to them and
 * where it starts.
 *
 * @author David Moss - dmm at rincon.com
 */
 
module PacketM {
  provides {
    interface Packet;
  }
}

implementation {


  /***************** Packet Commands ****************/
  /**
    * Clear out this packet.  Note that this is a deep operation and
    * total operation: calling clear() on any layer will completely
    * clear the packet for reuse.
    *
    * Note that the Transceiver relies on the AM type to
    * be present throughout the lifetime of an allocated
    * packet. This means we cannot clear the entire
    * packet, or we'd erase the AM type and the allocated
    * message would never get sent.
    */
  command void Packet.clear(TOS_MsgPtr msg) {
    memset(msg->data, 0, sizeof(msg->data));
  }

  /**
    * Return the length of the payload of msg. This value may be less
    * than what maxPayloadLength() returns, if the packet is smaller than
    * the MTU. If a communication component does not support variably
    * sized data regions, then payloadLength() will always return
    * the same value as maxPayloadLength(). 
    */

  command uint8_t Packet.payloadLength(TOS_MsgPtr msg) {
    return TOSH_DATA_LENGTH;
  }

  /**
   * Set the length of the payload in this packet
   */
  command void Packet.setPayloadLength(TOS_Msg *msg, uint8_t len) {
    msg->length  = len;
  }
  
 /**
   * Return the maximum payload length that this communication layer
   * can provide. Note that, depending on protocol fields, a
   * given request to send a packet may not be able to send the
   * maximum payload length (e.g., if there are variable length
   * fields). Protocols may provide specialized interfaces
   * for these circumstances.
   */
  command uint8_t Packet.maxPayloadLength() {
    return TOSH_DATA_LENGTH;
  }

 /**
   * Return point to a protocol's payload region in a packet.
   * If len is not NULL, getPayload will return the length of
   * the payload in it, which is the same as the return value
   * from payloadLength(). If a protocol does not support
   * variable length packets, then *len is equal to 
   * maxPayloadLength().
   */
  command void* Packet.getPayload(TOS_MsgPtr msg, uint8_t* len) {
    if(len != NULL) {
      *len = TOSH_DATA_LENGTH;
    }
    return msg->data;
  }
}


--- NEW FILE: FrequencyManager.nc ---

/**
 * Frequency manager for the CC1000 radio
 * @author David Moss
 */
 
interface FrequencyManager {

  /**
   * Tune to a preset frequency located in the preset array in the
   * CC1000Const.h file
   * @param presetFreqIndex - the index in the preset array to tune to
   * @return SUCCESS if the frequency is adjusted
   */
  command void tunePreset(uint8_t presetFreqIndex);
  
  /**
   * Tune to a manual frequency
   * @param freqHz - the frequency, in hertz, to tune to. i.e. 914077076
   * @return SUCCESSS if the frequency is adjusted
   */
  command uint32_t tuneManual(uint32_t freqHz);

  /** 
   * Auto-Recalibration is on by default.
   *
   * Enable or disable the automatic recalibrations. Temperature and
   * voltage variations will cause the frequency to drift over time.
   * Recalibrating the radio frequencies every few hours will prevent this
   * @param on - TRUE if recalibration should be on, FALSE if it shouldn't
   * @param hours - the delay, in hours, after which to auto recalibrate
   */
  command void setAutoRecalibration(bool on, uint8_t hours);  

  /**
   * Calibrate the CC1000 radio
   * @return SUCCESS if the radio is recalibrated
   */
  command result_t calibrate();
  
}


--- NEW FILE: RadioTimeStamping.nc ---
/*									tab:4
 * "Copyright (c) 2000-2005 The Regents of the University  of California.  
 * 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 UNIVERSITY OF CALIFORNIA 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 UNIVERSITY OF
 * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * 
 * THE UNIVERSITY OF CALIFORNIA 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 UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
 *
 */
/**
 * Interface for receiving time stamp information from the radio.
 * This information is also embedded in packet metadata.
 *
 * @author Jonathan Hui
 * @author Philip Levis
 * @author Joe Polastre
 * @author David Moss
 * @date   October 10 2005
 *
 */

interface RadioTimeStamping
{
  /** 
   * Provides the time at which start of frame delimiter has been
   * transmitted: units are in terms of a 32kHz clock.
   */
  async event void transmittedSFD( uint16_t time, TOS_Msg *p_msg );
  
  /** 
   * Provides the time at which start of frame delimiter was received:
   * units are in terms of a 32kHz clock.  <b>NOTE</b> that receiving
   * a receivedSFD() event does NOT mean that a packet will be
   * received; the transmission may stop, become corrupted, or be
   * filtered by the physical or link layers.  The number of rxSFD
   * events will always be great than or equal to the number of
   * Receive message events.
   */
  async event void receivedSFD( uint16_t time );
}

--- NEW FILE: HPLCC1000.nc ---
// $Id: HPLCC1000.nc,v 1.3 2003/10/07 21:46:30 idgay Exp $

/*									tab:4
 * "Copyright (c) 2000-2003 The Regents of the University  of California.  
 * 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 UNIVERSITY OF CALIFORNIA 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 UNIVERSITY OF
 * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * 
 * THE UNIVERSITY OF CALIFORNIA 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 UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
 *
 * Copyright (c) 2002-2003 Intel Corporation
 * All rights reserved.
 *
 * This file is distributed under the terms in the attached INTEL-LICENSE     
 * file. If you do not find these files, copies can be found by writing to
 * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA, 
 * 94704.  Attention:  Intel License Inquiry.
 */
/*
 * Authors:		Jason Hill, David Gay, Philip Levis
 * Date last modified:  6/25/02
 *
 *
 */

/**
 * @author Jason Hill
 * @author David Gay
 * @author Philip Levis
 */


interface HPLCC1000 {
  /**
   * Initialize CC1K pins
   *
   * @return SUCCESS if successful
   */
  command result_t init();

  /**
   * Transmit 8-bit data for 7-bit register address
   *
   * @return SUCCESS if successful
   */
  async command result_t write(uint8_t addr, uint8_t data);

  /**
   * Read 8-bit data for 7-bit register address
   *
   * @return data
   */
  async command uint8_t read(uint8_t addr);

  /**
   * Read a BINARY value from the CHP_OUT pin
   *
   * @return TRUE or FALSE
   */
  async command bool GetLOCK();
}

--- NEW FILE: PacketAcknowledgements.nc ---
/*									tab:4
 * "Copyright (c) 2000-2005 The Regents of the University  of California.  
 * 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 UNIVERSITY OF CALIFORNIA 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 UNIVERSITY OF
 * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * 
 * THE UNIVERSITY OF CALIFORNIA 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 UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
 *
 */

/**
 * This interface allows a component to enable or disable acknowledgments
 * on per-packet basis.
 *
 * @author Jonathan Hui
 * @author Philip Levis
 * @author Joe Polastre
 * @author David Moss
 * @date   October 10 2005
 */
interface PacketAcknowledgements {

  /**
   * Enable acknowledgments on this packet.
   *
   * @return SUCCESS if acknowledgements are enabled, EBUSY
   * if the communication layer cannot enable them at this time, FAIL
   * if it does not support them.
   */
  async command result_t requestAck(TOS_Msg *msg);

  /**
   * Disable acknowledgments on this packet. 
   *
   * @return SUCCESS if acknowledgements are disabled, EBUSY
   * if the communication layer cannot disable them at this time, FAIL
   * if it cannot support unacknowledged communication.
   */
  async command result_t noAck(TOS_Msg *msg);

  /**
   * Whether or not a given packet was acknowledged. If a packet
   * layer does not support acknowledgements, this must return always
   * return FALSE.
   *
   * @return Whether the packet was acknowledged.
   *
   */
  async command bool wasAcked(TOS_Msg *msg);
  
}

--- NEW FILE: Rssi.nc ---


/**
 * RSSI interface
 *
 * @author David Moss
 */
interface Rssi {

  /**
   * Start an RSSI read process
   * @return SUCCESS if the RSSI value will be read
   */
  async command result_t read();
  
  /**
   * Cancel the current RSSI read process
   */
  async command void cancel();
  
  
  /**
   * The RSSI read is complete
   * @param result - SUCCESS if the read was valid
   * @param data - the RSSI value
   */
  async event void readDone(result_t result, uint16_t data);
  
}


--- NEW FILE: CsmaControl.nc ---
/*									tab:4
 * "Copyright (c) 2000-2005 The Regents of the University  of California.  
 * 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 UNIVERSITY OF CALIFORNIA 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 UNIVERSITY OF
 * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * 
 * THE UNIVERSITY OF CALIFORNIA 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 UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
 *
 */
/**
 * Interface for activating/deactivating congestion control.
 *
 * @author Philip Levis
 * @author Joe Polastre
 * @date   August 31 2005
 */
interface CsmaControl {
  /**
   * Enable congestion control.
   * @return SUCCESS if congestion control enabled, FAIL otherwise.
   */
  async command result_t enableCca();

  /**
   * Disable congestion control.
   * @return SUCCESS if congestion control disabled, FAIL otherwise.
   */
  async command result_t disableCca();
}

--- NEW FILE: MacControl.nc ---
/*									tab:4
 *
 *
 * "Copyright (c) 2000-2002 The Regents of the University  of California.  
 * 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 UNIVERSITY OF CALIFORNIA 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 UNIVERSITY OF
 * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * 
 * THE UNIVERSITY OF CALIFORNIA 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 UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
 *
 */
/*									tab:4
 *  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.  By
 *  downloading, copying, installing or using the software you agree to
 *  this license.  If you do not agree to this license, do not download,
 *  install, copy or use the software.
 *
 *  Intel Open Source License 
 *
 *  Copyright (c) 2002 Intel 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 Intel 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 INTEL 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.
 * 
 * 
 */
/*
 *
 * Authors:		Joe Polastre
 * Date last modified:  $Revision: 1.2 $
 *
 * Interface for CC1000 specific controls and signals
 */

/**
 * Mac Control Interface
 */
interface MacControl
{
  async command void enableAck();
  async command void disableAck();
}

--- NEW FILE: ByteRadio.nc ---
/* $Id: ByteRadio.nc,v 1.1.2.5 2005/06/03 19:14:54 idgay Exp $
 * Copyright (c) 2005 Intel Corporation
 * All rights reserved.
 *
 * This file is distributed under the terms in the attached INTEL-LICENSE     
 * file. If you do not find these files, copies can be found by writing to
 * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA, 
 * 94704.  Attention:  Intel License Inquiry.
 */
 
/**
 * Radio logic is split between Csma (media-access control, low-power
 * listening and general control) and SendReceive (packet reception and
 * transmission). This interface specifies the interaction between these
 * two components.
 *
 * @author David Gay
 * @author David Moss
 */

includes AM;
interface ByteRadio {

  /**
   * Access to the media granted. Start sending. SendReceive must signal
   * sendDone when transmission is complete. Note: the media-access-contro
   * layer must have enabled listening before calling cts().
   */
  async command void cts();

  /**
   * Between the rts() and sendDone() events, this must return the
   * message under transmission.
   * @return Message being transmitted.
   */
  async command TOS_Msg *getTxMessage();

  /**
   * Setting the ByteRadio's ack to TRUE forces all outgoing
   * messages to request an ack.  If the byte radio forced ack 
   * is disabled, the ack is based on the current state of the
   * ack byte in the outgoing packet.
   * @param on TRUE to force acks on, FALSE to leave them per-packet.
   */
  async command void setAck(bool on);

  /**
   * Set message preamble length.
   * @param bytes Preamble length in bytes
   */
  async command void setPreambleLength(uint16_t bytes);

  /**
   * Get message preamble length.
   * @return Preamble length in bytes
   */
  async command uint16_t getPreambleLength();

  /**
   * Enable listening for incoming packets.
   */
  async command void listen();

  /**
   * Disable listening for incoming packets.
   */
  async command void off();

  /**
   * Detect if SendReceive is attempting to sync with an incoming packet.
   * During sync, idleByte events are not signaled. If sync is successful,
   * an rx() event will be signaled, if it fails, idleByte events will
   * resume. If syncing() returns TRUE, the last idleByte() event must
   * have had preamble = TRUE.
   *
   * @return TRUE if a sync attempt is in progress, FALSE if not.
   */
  async command bool syncing();

  /**
   * @return TRUE if the radio is not in the middle of an Rx or Tx
   */
  async command bool isFree();


  /**
   * SendReceive wants to send a packet.
   */
  event void rts();
  
  /**
   * SendReceive signals this event for every radio-byte-time while
   * listening is enabled and a message isn't being received or
   * transmitted.
   * @param preamble TRUE if a message preamble byte has been received
   */
  async event void idleByte(bool preamble);

  /**
   * A message is being received
   */
  async event void rx();

  /**
   * Message reception is complete.
   */
  async event void rxDone();
  
  /**
   * Transmission complete.
   */
  async event void sendDone();
  
}

--- NEW FILE: RadioMode.nc ---
/**
 * @author dmm
 */
 
interface RadioMode {

  /**
   * Put the radio in normal operation -
   * when a packet is sent, the radio is
   * kicked into Tx mode, then the packet is
   * transmitted, then the radio is kicked
   * back to Rx mode.  The Rx to Tx to Rx
   * steps cause a 600 us delay.
   */
  command result_t normalMode();
  
  /**
   * Put the radio in a transmit-only mode.
   * This takes out the 600 us delays between 
   * each sent packet
   */
  command result_t transmitMode();
  
  /**
   * @return TRUE if the radio is in normal mode
   */
  command bool isNormalMode();

  
}




--- NEW FILE: BusyWait.nc ---
/**
 * BusyWait is a low-level interface intended for busy waiting for short
 * durations.
 *
 * <p>BusyWait is parameterised by its "precision" (milliseconds,
 * microseconds, etc), identified by a type. This prevents, e.g.,
 * unintentionally mixing components expecting milliseconds with those
 * expecting microseconds as those interfaces have a different type.
 *
 * <p>BusyWait's second parameter is its "width", i.e., the number of bits
 * used to represent time values. Width is indicated by including the
 * appropriate size integer type as a BusyWait parameter.
 *
 * <p>See TEP102 for more details.
 *
 * @param precision_tag A type indicating the precision of this BusyWait
 *   interface.
 * @param size_type An integer type representing time values for this 
 *   BusyWait interface.
 *
 * @author Cory Sharp <cssharp at eecs.berkeley.edu>
 * @author David Moss
 */

interface BusyWait {
  /**
   * Busy wait for (at least) dt time units. Use sparingly, when the
   * cost of using an Alarm or Timer would be too high.
   * @param dt Time to busy wait for.
   */
  async command void wait(uint16_t dt);
}




More information about the Tinyos-contrib-commits mailing list