[Tinyos-contrib-commits] CVS: tinyos-1.x/contrib/scp-mac/apps/PhyTestReceiver Makefile, NONE, 1.1 PhyTestReceiver.nc, NONE, 1.1 PhyTestReceiverM.nc, NONE, 1.1 README, NONE, 1.1 config.h, NONE, 1.1 testMsg.h, NONE, 1.1
Wei Ye
weiyeisi at users.sourceforge.net
Tue May 6 10:30:59 PDT 2008
- Previous message: [Tinyos-contrib-commits] CVS: tinyos-1.x/contrib/scp-mac/apps/MacTest MacTestM.nc, NONE, 1.1 README, NONE, 1.1 testMsg.h, NONE, 1.1
- Next message: [Tinyos-contrib-commits] CVS: tinyos-1.x/contrib/scp-mac/apps/PhyTestSender Makefile, NONE, 1.1 PhyTestSender.nc, NONE, 1.1 PhyTestSenderM.nc, NONE, 1.1 README, NONE, 1.1 config.h, NONE, 1.1 testMsg.h, NONE, 1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/tinyos/tinyos-1.x/contrib/scp-mac/apps/PhyTestReceiver
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv9805/scp-mac/apps/PhyTestReceiver
Added Files:
Makefile PhyTestReceiver.nc PhyTestReceiverM.nc README
config.h testMsg.h
Log Message:
scp-mac implementation from USC/ISI
--- NEW FILE: Makefile ---
COMPONENT=PhyTestReceiver
ifdef SLPLDIR
include $(SLPLDIR)/../apps/Makeapps
else
# assume SLPLDIR is ../../tos
include ../Makeapps
endif
--- NEW FILE: PhyTestReceiver.nc ---
/*
* Copyright (C) 2003-2005 the University of Southern California.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*
* In addition to releasing this program under the LGPL, the authors are
* willing to dual-license it under other terms. You may contact the authors
* of this project by writing to Wei Ye, USC/ISI, 4676 Admirality Way, Suite
* 1001, Marina del Rey, CA 90292, USA.
*/
/*
* Authors: Wei Ye
*
* Receiver part for testing the physical layer
*/
includes config; // include config.h first
includes testMsg;
configuration PhyTestReceiver { }
implementation
{
components Main, PhyTestReceiverM, PhyRadio, RandomLFSR, TimerC, LedsC;
Main.StdControl -> PhyTestReceiverM;
PhyTestReceiverM.PhyControl -> PhyRadio;
PhyTestReceiverM.PhyPkt -> PhyRadio;
PhyTestReceiverM.PhyNotify -> PhyRadio;
PhyTestReceiverM.TxTimer -> TimerC.Timer[unique("Timer")];
PhyTestReceiverM.Leds -> LedsC;
}
--- NEW FILE: PhyTestReceiverM.nc ---
/*
* Copyright (C) 2003-2005 the University of Southern California.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*
* In addition to releasing this program under the LGPL, the authors are
* willing to dual-license it under other terms. You may contact the authors
* of this project by writing to Wei Ye, USC/ISI, 4676 Admirality Way, Suite
* 1001, Marina del Rey, CA 90292, USA.
*/
/*
* Authors: Wei Ye
*
* Receiver part for testing the physical layer
*/
module PhyTestReceiverM
{
provides interface StdControl;
uses {
interface StdControl as PhyControl;
interface PhyPkt;
interface PhyNotify;
interface Timer as TxTimer;
interface Leds;
}
}
implementation
{
AppPkt dataPkt; // message to be sent
uint8_t numRx; // number of succesfully received pkts
uint8_t numLenErr; // number of errors in length field
uint8_t numErrPkt; // number of received pkts with CRC errors
uint8_t numStart; // number of packets that received first byte
uint8_t numSeq; // sequence number for packet
bool finished;
command result_t StdControl.init()
{
numRx = 0;
numLenErr = 0;
numErrPkt = 0;
numStart = 0;
numSeq = 0;
finished = FALSE;
call Leds.init();
call PhyControl.init(); // initialize physical layer
return SUCCESS;
}
command result_t StdControl.start()
{
call PhyControl.start();
return SUCCESS;
}
command result_t StdControl.stop()
{
call PhyControl.stop();
return SUCCESS;
}
event result_t PhyPkt.sendDone(void* msg)
{
call Leds.greenToggle();
return SUCCESS;
}
async event result_t PhyNotify.startSymSent(void* pkt)
{
return SUCCESS;
}
async event result_t PhyNotify.startSymDetected(void* pkt, uint8_t bitOffset)
{
numStart++;
return SUCCESS;
}
event void* PhyPkt.receiveDone(void* data, uint8_t error)
{
if (call TxTimer.getRemainingTime() == 0) {
call TxTimer.start(TIMER_REPEAT, TST_REPORT_DELAY);
} else {
call TxTimer.setRemainingTime(TST_REPORT_DELAY);
}
if (data == NULL) {
numLenErr++;
return data;
}
if (error)
numErrPkt++;
else {
numRx++;
if (numRx < TST_NUM_PKTS) {
call Leds.redToggle();
} else {
if (finished == FALSE){
finished = TRUE;
// turn on all LEDs to show successful Rx of all packets
call Leds.greenOff();
call Leds.yellowOn();
call Leds.redOff();
}
else{
// Received extra packets after finishing
call Leds.redToggle();
}
}
}
return data;
}
event result_t TxTimer.fired()
{
// time to report my results
// remember result of this group of packets
dataPkt.hdr.seqNo = numSeq++;
dataPkt.data[0] = numRx; // received pkts without error
dataPkt.data[1] = numLenErr; // num of errors in length field
dataPkt.data[2] = numErrPkt; // received pkts w/ CRC errors
dataPkt.data[3] = numStart; // pkts whose first byte is received
// report my reception result
call PhyPkt.send(&dataPkt, sizeof(AppPkt), 0);
return SUCCESS;
}
} // end of implementation
--- NEW FILE: README ---
1. INTRODUCTION
This application tests the Physical Layer (PHY) developed at USC/ISI.
The primary component of the physical layer that provides the interface
to upper layer is PHY_RADIO. The mote programmed by this application is a
receiver that counts the number of succesfully received packets and packets
that are received with errors.
The transmitter part is at apps/PhyTestSender/.
2. FUNCTIONALITY
The receiver records the following values, and toggle its green LED when
a packet is successfully received.
* Number start symbol detections
* Number of 'length' (the first field in a packet) errors
* Number of CRC errors
* Number of received packets without any errors
At the end of the group of packets, the receiver sends out a packet to
report its above results. This is triggered by a timer, whose delay time
can configured to match the Tx interval on the sender.
3. HOW TO USE
To use all the default parameters, simply type 'make mica2' and/or 'make
install mica2'.
The following parameters can be defined in the config.h file. If not
defined, their default values will be used.
To change different options, please look at config.h for details.
4. NOTES
1) This application is to be used with a transmitter part, which is at
apps/PhyTestSender/.
2) You can use a snooper (at apps/Snooper/) to see the contents of each packet
sent by the sender as well as the report packet sent by the receiver at the end
of each group.
--- NEW FILE: config.h ---
/*
* Copyright (C) 2003-2005 the University of Southern California.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*
* In addition to releasing this program under the LGPL, the authors are
* willing to dual-license it under other terms. You may contact the authors
* of this project by writing to Wei Ye, USC/ISI, 4676 Admirality Way, Suite
* 1001, Marina del Rey, CA 90292, USA.
*/
/*
* Authors: Wei Ye
*
* This file configures parameters of all components used by the application.
* It is supposed to be included before any other files in an
* application's configuration (wiring) file, such as Test.nc, so that these
* macro definations will override default definations in other files.
* These macros are in the global name space, so use a prefix to indicate
* which layers they belong to.
*
*/
#ifndef CONFIG
#define CONFIG
// Configure Physical layer. Definitions here override default values
// Default values are defined in PhyMsg.h
// --------------------------------------------------------------
//#define PHY_MAX_PKT_LEN 250 // max: 250, default: 100
// Configure the test application
// -------------------------------
// Number of packets in each group. Should match that in apps/PhyTestSender/
#define TST_NUM_PKTS 100
// delay time (binary ms) to send a report packet
#define TST_REPORT_DELAY 10240
// enable/disable UART debug
//#define UART_DEBUG_ENABLE
// Debugging with LEDS
#define PHY_LED_DEBUG
#endif // CONFIG
--- NEW FILE: testMsg.h ---
/*
* Copyright (C) 2003-2005 the University of Southern California.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*
* In addition to releasing this program under the LGPL, the authors are
* willing to dual-license it under other terms. You may contact the authors
* of this project by writing to Wei Ye, USC/ISI, 4676 Admirality Way, Suite
* 1001, Marina del Rey, CA 90292, USA.
*/
/*
* Authors: Wei Ye
*
* Message format for testing the physical layer -- PhyRadio
*/
#ifndef TEST_MSG
#define TEST_MSG
// include physical layer header defination
#include "PhyRadioMsg.h"
typedef struct {
PhyHeader hdr; // include lower-layer header first
uint8_t seqNo;
} AppHeader;
/* AppHeader should be the same as the sender */
typedef struct {
AppHeader hdr;
char data[20];
int16_t crc; // crc must be the last field -- required by PhyRadio
} AppPkt;
#endif
- Previous message: [Tinyos-contrib-commits] CVS: tinyos-1.x/contrib/scp-mac/apps/MacTest MacTestM.nc, NONE, 1.1 README, NONE, 1.1 testMsg.h, NONE, 1.1
- Next message: [Tinyos-contrib-commits] CVS: tinyos-1.x/contrib/scp-mac/apps/PhyTestSender Makefile, NONE, 1.1 PhyTestSender.nc, NONE, 1.1 PhyTestSenderM.nc, NONE, 1.1 README, NONE, 1.1 config.h, NONE, 1.1 testMsg.h, NONE, 1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Tinyos-contrib-commits
mailing list