[Tinyos-2-commits] CVS: tinyos-2.x/apps/tests/RadioStress Makefile, NONE, 1.1.4.2 RadioStress.h, NONE, 1.1.4.2 RadioStressAppC.nc, NONE, 1.1.4.2 RadioStressC.nc, NONE, 1.1.4.2 gdb-file, NONE, 1.1.4.2

Kevin Klues klueska at users.sourceforge.net
Mon May 15 11:35:25 PDT 2006


Update of /cvsroot/tinyos/tinyos-2.x/apps/tests/RadioStress
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv18756/apps/tests/RadioStress

Added Files:
      Tag: tos-2-resource-pm-eval-cand
	Makefile RadioStress.h RadioStressAppC.nc RadioStressC.nc 
	gdb-file 
Log Message:
Merging the development branch with the resource/power management evaluation branch.  After this merge all files except those already commited should be identical.

--- NEW FILE: Makefile ---
COMPONENT=RadioStressAppC
PFLAGS += -I%T/lib/oski 
#PFLAGS += -g
include $(MAKERULES)


--- NEW FILE: RadioStress.h ---
typedef nx_struct RadioCountMsg {
  nx_uint16_t counter;
} RadioCountMsg;

enum {
  AM_RADIOCOUNTMSG = 6,
};

--- NEW FILE: RadioStressAppC.nc ---
// $Id: RadioStressAppC.nc,v 1.1.4.2 2006/05/15 18:35:23 klueska 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.
 */

/**
 * This application sends OSKI broadcasts at 1Hz and blinks LED 0 when
 * it receives a broadcast.
 *
 * @author Philip Levis
 * @date   June 6 2005
 */

#include "RadioStress.h"

configuration RadioStressAppC {}
implementation {
  components MainC, RadioStressC as App, LedsC;
  components new AMSenderC(AM_RADIOCOUNTMSG);
  components new AMReceiverC(AM_RADIOCOUNTMSG);
  components new TimerMilliC();
  components ActiveMessageC;
  
  
  
  App.Boot -> MainC.Boot;
  
  App.Receive -> AMReceiverC;
  App.AMSend -> AMSenderC;
  App.RadioControl -> ActiveMessageC;
  App.Leds -> LedsC;
  App.Packet -> AMSenderC;
  App.Acks -> AMSenderC;
  App.Timer -> TimerMilliC;
}



--- NEW FILE: RadioStressC.nc ---
// $Id: RadioStressC.nc,v 1.1.4.2 2006/05/15 18:35:23 klueska 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-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.
 */

/**
 *  Implementation of the OSKI RadioCountToLeds application. This
 *  application periodically broadcasts a 16-bit counter, and displays
 *  broadcasts it hears on its LEDs.
 *
 *  @author Philip Levis
 *  @date   June 6 2005
 *
 **/

#include "Timer.h"
#include "RadioStress.h"

module RadioStressC {
  uses {
    interface Leds;
    interface Boot;
    interface Receive;
    interface AMSend;
    interface SplitControl as RadioControl;
    interface Packet;
    interface Timer<TMilli>;
    interface PacketAcknowledgements as Acks;
  }
}
implementation {

  message_t packet;

  bool locked;
  bool resourceHeld;
  uint32_t txCounter = 0;
  uint32_t ackCounter = 0;
  uint32_t rxCounter = 0;
  int16_t timerCounter = -1;
  uint16_t taskCounter = 0;
  uint16_t errorCounter = 0;
  
  event void Boot.booted() {
    call Leds.led0On();
    call RadioControl.start();
  }

  task void sendTask();

  void sendPacket() {
    RadioCountMsg* rcm = (RadioCountMsg*)call Packet.getPayload(&packet, NULL);
    if (locked) {return;}
    rcm->counter = txCounter;
    if (call AMSend.send(AM_BROADCAST_ADDR, &packet, 2) == SUCCESS) {
      locked = TRUE;
    }
    else {
      post sendTask();
    }
  }

  task void sendTask() {
    taskCounter++;
    sendPacket();
  }
  
  event void RadioControl.startDone(error_t err) {
    if (err != SUCCESS) {
      call RadioControl.start();
    }
    else {
      call Leds.led1On();
      call Timer.startPeriodic(1000);
      //call Acks.enable();
    }
  }

  event void RadioControl.stopDone(error_t err) {

  }


  event message_t* Receive.receive(message_t* bufPtr, 
				   void* payload, uint8_t len) {
    rxCounter++;
    if ((rxCounter % 32) == 0) {
      call Leds.led0Toggle();
    }
    return bufPtr;
  }

  event void AMSend.sendDone(message_t* bufPtr, error_t error) {
    if (error != SUCCESS) {
      errorCounter++;
    }
    txCounter++;
    if (txCounter % 32 == 0) {
      call Leds.led1Toggle();
    }
    if (call Acks.wasAcked(bufPtr)) {
      ackCounter++;
      if (ackCounter % 32 == 0) {
	call Leds.led2Toggle();
      }
    }
    locked = FALSE;
    sendPacket();
  }

  event void Timer.fired() {
    call Leds.led2Toggle();
    timerCounter++;
    if (!locked) {
      sendPacket();
    }
	
  }

}





--- NEW FILE: gdb-file ---
define printTxPps 
  print RadioStressC$txCounter / RadioStressC$timerCounter 
  end

define printAckPps 
  print RadioStressC$ackCounter / RadioStressC$timerCounter 
  end

define printAckPercent
  print (double)RadioStressC$ackCounter / (double)RadioStressC$txCounter
  end

define printErrorRate
  print (double)RadioStressC$errorCounter / (double)RadioStressC$txCounter
  end

define printErrorPps
  print RadioStressC$error / RadioStressC$timerCounter 
  end

define printRxPps 
  print RadioStressC$rxCounter / RadioStressC$timerCounter
  end




More information about the Tinyos-2-commits mailing list