[Tinyos-2-commits] CVS: tinyos-2.x/apps/IPBaseStation BaseStationC.nc, NONE, 1.1 BaseStationP.nc, NONE, 1.1 Makefile, NONE, 1.1 README, NONE, 1.1 Reset.h, NONE, 1.1 Reset.nc, NONE, 1.1

sdhsdh sdhsdh at users.sourceforge.net
Mon Jan 19 16:33:24 PST 2009


Update of /cvsroot/tinyos/tinyos-2.x/apps/IPBaseStation
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv7358/IPBaseStation

Added Files:
	BaseStationC.nc BaseStationP.nc Makefile README Reset.h 
	Reset.nc 
Log Message:
 - commit blip stack apps



--- NEW FILE: BaseStationC.nc ---
/*
 * "Copyright (c) 2008 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
z * 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."
 *
 */
// $Id: BaseStationC.nc,v 1.1 2009/01/20 00:33:22 sdhsdh 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.
 */

/**
 * The TinyOS 2.x base station that forwards packets between the UART
 * and radio.It replaces the GenericBase of TinyOS 1.0 and the
 * TOSBase of TinyOS 1.1.
 *
 * <p>On the serial link, BaseStation sends and receives simple active
 * messages (not particular radio packets): on the radio link, it
 * sends radio active messages, whose format depends on the network
 * stack being used. BaseStation will copy its compiled-in group ID to
 * messages moving from the serial link to the radio, and will filter
 * out incoming radio messages that do not contain that group ID.</p>
 *
 * <p>BaseStation includes queues in both directions, with a guarantee
 * that once a message enters a queue, it will eventually leave on the
 * other interface. The queues allow the BaseStation to handle load
 * spikes.</p>
 *
 * <p>BaseStation acknowledges a message arriving over the serial link
 * only if that message was successfully enqueued for delivery to the
 * radio link.</p>
 *
 * <p>The LEDS are programmed to toggle as follows:</p>
 * <ul>
 * <li><b>RED Toggle:</b>: Message bridged from serial to radio</li>
 * <li><b>GREEN Toggle:</b> Message bridged from radio to serial</li>
 * <li><b>YELLOW/BLUE Toggle:</b> Dropped message due to queue overflow in either direction</li>
 * </ul>
 *
 * @author Phil Buonadonna
 * @author Gilman Tolle
 * @author David Gay
 * @author Philip Levis
 * @date August 10 2005
 */

configuration BaseStationC {
}
implementation {
  components MainC, BaseStationP, LedsC;
#ifndef SIM
  components CC2420ActiveMessageC as Radio;
  components SerialDispatcherC as SerialControl, Serial802_15_4C as Serial;
#else 
  components ActiveMessageC as Radio;
  components SerialActiveMessageC as Serial;
#endif
  
  MainC.Boot <- BaseStationP;

  BaseStationP.RadioControl -> Radio;
#ifndef SIM
  BaseStationP.SerialControl -> SerialControl;
  BaseStationP.UartSend -> Serial.Send;
  BaseStationP.UartReceive -> Serial.Receive;
#else
  BaseStationP.SerialControl -> Serial;
  BaseStationP.UartSend -> Serial.AMSend[0];
  BaseStationP.UartReceive -> Serial.Receive[0];
#endif
  

#ifndef SIM  
  BaseStationP.RadioSend -> Radio;
  BaseStationP.RadioReceive -> Radio.IEEE154Receive;
#else
  BaseStationP.RadioSend -> Radio.AMSend[0];
  BaseStationP.RadioReceive -> Radio.ReceiveBase[0];
  BaseStationP.SerialAMPacket -> Serial;
  BaseStationP.SerialPacket -> Serial;
#endif

  BaseStationP.RadioPacket -> Radio.SubAMPacket;
  BaseStationP.RadioIEEEPacket -> Radio;
  
  BaseStationP.Leds -> LedsC;

  BaseStationP.PacketLink -> Radio;
  BaseStationP.LowPowerListening -> Radio;

  components ResetC;
  BaseStationP.Reset -> ResetC;

#ifndef SIM
  components SerialDevConfC as Configure;
  BaseStationP.ConfigureSend -> Configure;
  BaseStationP.ConfigureReceive -> Configure;

  components new TimerMilliC();
  BaseStationP.ConfigureTimer -> TimerMilliC;

  components IPAddressC;
  BaseStationP.IPAddress -> IPAddressC;

  components CC2420ControlC;
  BaseStationP.CC2420Config -> CC2420ControlC;
#endif
}

--- NEW FILE: BaseStationP.nc ---
/*
 * "Copyright (c) 2008 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."
 *
 */
// $Id: BaseStationP.nc,v 1.1 2009/01/20 00:33:22 sdhsdh Exp $

/*									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."
 *
 * 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.
 */

/*
 * @author Phil Buonadonna
 * @author Gilman Tolle
 * @author David Gay
 * Revision:	$Id: BaseStationP.nc,v 1.1 2009/01/20 00:33:22 sdhsdh Exp $
 */
  
/* 
 * BaseStationP bridges packets between a serial channel and the radio.
 * Messages moving from serial to radio will be tagged with the group
 * ID compiled into the TOSBase, and messages moving from radio to
 * serial will be filtered by that same group id.
 */

#ifndef SIM
#include "CC2420.h"
#endif
#include "AM.h"
#include "Serial.h"
#include "devconf.h"
#include "lib6lowpan.h"

module BaseStationP {
  uses {
    interface Boot;
    interface SplitControl as SerialControl;
    interface SplitControl as RadioControl;

#ifndef SIM
    interface Send as UartSend;
    interface IEEE154Send as RadioSend;
#else
    interface AMSend as UartSend;
    interface AMSend as RadioSend;
    interface AMPacket as SerialAMPacket;
    interface Packet as SerialPacket;
#endif

    interface Receive as UartReceive;
    interface Receive as RadioReceive;
    interface Packet as RadioPacket;

#ifndef SIM
    interface Send as ConfigureSend;
    interface Receive as ConfigureReceive;
    interface Timer<TMilli> as ConfigureTimer;
    interface IPAddress;
#endif


#ifndef SIM
    interface IEEE154Packet as RadioIEEEPacket;
#else
    interface AMPacket as RadioIEEEPacket;
#endif

    interface PacketLink;
    interface LowPowerListening;
    interface CC2420Config;

    interface Leds;

    interface Reset;
  }
}

implementation
{
  enum {
    UART_QUEUE_LEN = 10,
    RADIO_QUEUE_LEN = 10,
  };

  uint16_t radioRetries = 10;
  uint16_t radioDelay   = 30;

  uint16_t serial_read;
  uint16_t radio_read;
  uint16_t serial_fail;
  uint16_t radio_fail;

  bool echo_busy;
  message_t echo_buf;
  config_reply_t *reply;

  message_t  uartQueueBufs[UART_QUEUE_LEN];
  message_t  *uartQueue[UART_QUEUE_LEN];
  uint8_t    uartIn, uartOut;
  bool       uartBusy, uartFull;

  message_t  radioQueueBufs[RADIO_QUEUE_LEN];
  message_t  *radioQueue[RADIO_QUEUE_LEN];
  uint8_t    radioIn, radioOut;
  bool       radioBusy, radioFull;

  task void uartSendTask();
  task void radioSendTask();

  void dropBlink() {
    call Leds.led2Toggle();
  }

  void failBlink() {
    call Leds.led2Toggle();
  }

#ifndef SIM
#define CHECK_NODE_ID if (0) return
#else
#define CHECK_NODE_ID if (TOS_NODE_ID != BASESTATION_ID) return
#endif
  task void configureReply() {
    if (echo_busy) return;

    reply->addr = call IPAddress.getShortAddr();
    reply->serial_read = serial_read;
    reply->radio_read = radio_read;
    reply->serial_fail = serial_fail;
    reply->radio_fail = radio_fail;

    echo_busy = TRUE;
    // delay sending the reply for a bit
    // the pc seems to usually drop the packet if we don't do this; 
    call ConfigureTimer.startOneShot(50);
  }

  event void Boot.booted() {
    uint8_t i;

    CHECK_NODE_ID;

    for (i = 0; i < UART_QUEUE_LEN; i++)
      uartQueue[i] = &uartQueueBufs[i];
    uartIn = uartOut = 0;
    uartBusy = FALSE;
    uartFull = TRUE;

    for (i = 0; i < RADIO_QUEUE_LEN; i++)
      radioQueue[i] = &radioQueueBufs[i];
    radioIn = radioOut = 0;
    radioBusy = FALSE;
    radioFull = TRUE;

    echo_busy = FALSE;
    serial_read = 0;
    radio_read = 0;
    serial_fail = 0;
    radio_fail = 0;

    call RadioControl.start();
    call SerialControl.start();

    reply = (config_reply_t *)(&(echo_buf.data));
  }

  event void RadioControl.startDone(error_t error) {
    CHECK_NODE_ID;
    if (error == SUCCESS) {
      radioFull = FALSE;
#ifdef LPL_SLEEP_INTERVAL
      call LowPowerListening.setLocalSleepInterval(LPL_SLEEP_INTERVAL);
#endif
    }
  }

  event void SerialControl.startDone(error_t error) {
    CHECK_NODE_ID;
    if (error == SUCCESS) {
      uartFull = FALSE;
    }
    reply->error = CONFIG_ERROR_BOOTED;
    post configureReply();
  }

  event void SerialControl.stopDone(error_t error) {}
  event void RadioControl.stopDone(error_t error) {}

  uint8_t count = 0;

  message_t* receive(message_t* msg, void* payload, uint8_t len);
  
  event message_t *RadioReceive.receive(message_t *msg,
                                           void *payload,
                                           uint8_t len) {
    CHECK_NODE_ID NULL;
    dbg("base", "radio message received (%i)\n", len);
    return receive(msg, payload, len);
  }

  message_t* receive(message_t *msg, void *payload, uint8_t len) {
    message_t *ret = msg;
    CHECK_NODE_ID NULL;

    atomic {
      if (!uartFull)
	{
	  ret = uartQueue[uartIn];
	  uartQueue[uartIn] = msg;

	  uartIn = (uartIn + 1) % UART_QUEUE_LEN;
	
	  if (uartIn == uartOut)
	    uartFull = TRUE;

	  if (!uartBusy)
	    {
	      post uartSendTask();
	      uartBusy = TRUE;
	    }
	}
      else
	dropBlink();
    }
    
    return ret;
  }

  task void uartSendTask() {
    uint8_t len;
    message_t* msg;
    atomic
      if (uartIn == uartOut && !uartFull)
	{
	  uartBusy = FALSE;
	  return;
	}

    msg = uartQueue[uartOut];

    // Since we're forwarding fully formed radio packets, we can use
    // these headers.
#ifdef DBG_TRACK_FLOWS
    len = call RadioPacket.payloadLength(msg) + sizeof(flow_id_t);
#else
    len = call RadioPacket.payloadLength(msg) - sizeof(am_header_t);
#endif

#ifdef SIM
    if (call UartSend.send(call RadioIEEEPacket.source(uartQueue[uartOut]),
                           uartQueue[uartOut], len) == SUCCESS)
#else
    if (call UartSend.send(uartQueue[uartOut], len) == SUCCESS)
#endif
      call Leds.led1Toggle();
    else
      {
	failBlink();
	post uartSendTask();
      }
  }

  event void UartSend.sendDone(message_t* msg, error_t error) {
    if (error != SUCCESS)
      failBlink();
    else
      atomic
	if (msg == uartQueue[uartOut])
	  {
	    if (++uartOut >= UART_QUEUE_LEN)
	      uartOut = 0;
	    if (uartFull)
	      uartFull = FALSE;
	  }
    post uartSendTask();
  }

  event message_t *UartReceive.receive(message_t *msg,
                                       void *payload,
                                       uint8_t len) {
    message_t *ret = msg;
    bool reflectToken = FALSE;
    CHECK_NODE_ID msg;
    dbg("base", "uartreceive len %i of 0x%x\n", len, call SerialAMPacket.destination(msg));

    atomic
      if (!radioFull)
	{
	  reflectToken = TRUE;
	  ret = radioQueue[radioIn];
	  radioQueue[radioIn] = msg;
	  if (++radioIn >= RADIO_QUEUE_LEN)
	    radioIn = 0;
	  if (radioIn == radioOut)
	    radioFull = TRUE;

	  if (!radioBusy)
	    {
	      post radioSendTask();
	      radioBusy = TRUE;
	    }
	}
      else
        dbg("base", "no enqueue\n");
// 	dropBlink();

    if (reflectToken) {
      //call UartTokenReceive.ReflectToken(Token);
    }
    
    return ret;
  }

  task void radioSendTask() {
    uint8_t len;
    hw_addr_t addr;
    message_t* msg;
    
    dbg ("base", "radioSendTask()\n");
    atomic
      if (radioIn == radioOut && !radioFull)
	{
	  radioBusy = FALSE;
	  return;
	}

    msg = radioQueue[radioOut];
#ifndef SIM
    len = call RadioPacket.payloadLength(msg);
    addr = call RadioIEEEPacket.destination(msg);
#else
#ifdef DBG_TRACK_FLOWS
    len = call SerialPacket.payloadLength(msg) - sizeof(flow_id_t);
#else
    len = call SerialPacket.payloadLength(msg);
#endif
    { 
      hw_addr_t source;
      addr = call SerialAMPacket.destination(msg);
      source = TOS_NODE_ID;

      call RadioPacket.clear(msg);
      call RadioIEEEPacket.setSource(msg, source);
    }
#endif

    if (addr != 0xFFFF) {
      call PacketLink.setRetries(msg, radioRetries);
      call PacketLink.setRetryDelay(msg, radioDelay);
    } else {
      call PacketLink.setRetries(msg, 0);
    }
#ifdef LPL_SLEEP_INTERVAL
    call LowPowerListening.setRxSleepInterval(msg, LPL_SLEEP_INTERVAL);
#endif
    dbg("base", "radio send to: 0x%x len: %i\n", addr, len);
    if (call RadioSend.send(addr, msg, len) == SUCCESS)
      call Leds.led0Toggle();
    else
      {
	failBlink();
	post radioSendTask();
      }
  }

  event void RadioSend.sendDone(message_t* msg, error_t error) {
    CHECK_NODE_ID;
    dbg("base", "sendDone()\n");
    
    //if (!call PacketLink.wasDelivered(msg))
    // failBlink();
    if (error != SUCCESS)
      failBlink();
    else
      atomic
	if (msg == radioQueue[radioOut])
	  {
	    if (++radioOut >= RADIO_QUEUE_LEN)
	      radioOut = 0;
	    if (radioFull)
	      radioFull = FALSE;
	  }
    
    post radioSendTask();
  }

#ifndef SIM
  event message_t *ConfigureReceive.receive(message_t *msg,
                                            void *payload,
                                            uint8_t len) {
    config_cmd_t *cmd;
    uint8_t error = CONFIG_ERROR_OK;
    if (len != sizeof(config_cmd_t) || msg == NULL) return msg;
    // don't parse the message if we can't reply

    cmd = (config_cmd_t *)&msg->data;

    switch (cmd->cmd) {
    case CONFIG_ECHO:
      break;
    case CONFIG_SET_PARM:
      call CC2420Config.setChannel(cmd->rf.channel);
      // IPAddress calls sync() for you, I think, so we'll put it second 
      call IPAddress.setShortAddr(cmd->rf.addr);
      call CC2420Config.sync();
      radioRetries = cmd->retx.retries;
      radioDelay   = cmd->retx.delay;
      break;
    case CONFIG_REBOOT:
      call Reset.reset();
      break;
    }
    if (!echo_busy) {
      reply->error = error;
      post configureReply();
    }
    return msg;
  }


  event void CC2420Config.syncDone(error_t error) {

  }

  event void ConfigureSend.sendDone(message_t *msg, error_t error) {
    echo_busy = FALSE;
  }

  event void ConfigureTimer.fired() {
    call Leds.led2Toggle();
    if (call ConfigureSend.send(&echo_buf, sizeof(config_reply_t)) != SUCCESS)
      echo_busy = FALSE;
  }
#endif
}  

--- NEW FILE: Makefile ---
COMPONENT=BaseStationC

# radio options.  channel settings will be overridden by the driver
# CFLAGS += -DCC2420_DEF_RFPOWER=4

# this is necessary, otherwise we will allocate a heap by including
# the lowpan target
CFLAGS += -DNO_IP_MALLOC

#
# debugging
#

# filter packets based on a specified topology
# PFLAGS += -I../UDPEcho/NodeConnectivity -DSW_TOPOLOGY

# part of the test harness
# CFLAGS += -DDBG_TRACK_FLOWS

# for simulation
# CFLAGS += -DBASESTATION_ID=100

include $(MAKERULES)


--- NEW FILE: README ---
README for BaseStation
Author/Contact: tinyos-help at millennium.berkeley.edu

IPBaseStation is a modification of the generic BaseStation which ships
with tinyOS-2.x.  It alters the serial protocol to pass 802.15.4
frames instead of Serial.h packets.  It also adds an out-of-band
configuration protocol which allows a driver running over the serial
port to reboot the mote, and to set the device address, channel, and
retransmission parameters.  These changes are useful when one wishes
to use a mote attached to a computer as an 802.15.4 interface rather
then an actual mote.  The actual queuing logic for copying packets is
mostly unchanged, and it continues to make use of serial ACKs.

Description of BaseStation:

BaseStation is an application that acts as a simple Active Message
bridge between the serial and radio links. It replaces the GenericBase
of TinyOS 1.0 and the TOSBase of TinyOS 1.1.

On the serial link, BaseStation sends and receives simple active
messages (not particular radio packets): on the radio link, it sends
radio active messages, whose format depends on the network stack being
used. BaseStation will copy its compiled-in group ID to messages
moving from the serial link to the radio, and will filter out incoming
radio messages that do not contain that group ID.

BaseStation includes queues in both directions, with a guarantee that
once a message enters a queue, it will eventually leave on the other
interface. The queues allow the BaseStation to handle load spikes more
gracefully.

BaseStation acknowledges a message arriving over the serial link only if
that message was successfully enqueued for delivery to the radio link.

The LEDS are programmed to toggle as follows:

RED Toggle         - Message bridged from serial to radio
GREEN Toggle       - Message bridged from radio to serial
YELLOW/BLUE Toggle - Dropped message due to queue overflow 
                     in either direction

When using a CC2420 radio, several default preprocessor configurations
are defined in the Makefile:
  * CC2420_NO_ACKNOWLEDGEMENTS
    - Prevents the base station from falsly acknowledging packets
  * CC2420_NO_ADDRESS_RECOGNITION
    - Allows the base station to sniff packets from any transmitter

Other combinations can be defined to meet your application's needs:
  * CC2420_NO_ADDRESS_RECOGNITION only
    - Sniff all packets, but acknowledge packets only if they
      are sent to the base station's address

  * Removing all preprocessor definitions in the Makefile
    - Only accept packets destined for the base station's address,
      and acknowledge those packets


Tools:

tools/java/net/tinyos/sf/SerialForwarder.  

See doc/serialcomm/index.html for more information using these tools.

Known bugs/limitations:



--- NEW FILE: Reset.h ---
// $Id: Reset.h,v 1.1 2009/01/20 00:33:22 sdhsdh 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:  Wei Hong
 *           Intel Research Berkeley Lab
 * Date:     7/15/2002
 *
 */

/**
 * @author Wei Hong
 * @author Intel Research Berkeley Lab
 */


void resetMote()
{
#if defined(PLATFORM_MICA) || defined(PLATFORM_MICA2) || defined(PLATFORM_MICA2DOT) || defined(PLATFORM_MICAZ)
    	cli(); 
  	wdt_enable(0); 
  	while (1) { 
  		__asm__ __volatile__("nop" "\n\t" ::);
  	}
#elif defined(PLATFORM_TELOS) || defined(PLATFORM_TELOSB) || defined(PLATFORM_EPIC)
        WDTCTL = 0;
#else
#error "Reset.h not defined/supported for your platform, aborting..."
#endif
}


--- NEW FILE: Reset.nc ---
// $Id: Reset.nc,v 1.1 2009/01/20 00:33:22 sdhsdh 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:  Wei Hong
 *           Intel Research Berkeley Lab
 * Date:     7/15/2002
 *
 */

/**
 * @author Wei Hong
 * @author Intel Research Berkeley Lab
 */


interface Reset {
  command void reset();
}



More information about the Tinyos-2-commits mailing list