[Tinyos-contrib-commits]
CVS: tinyos-1.x/contrib/ustutt/ncunit/mote/internal
TestStarter.nc, NONE, 1.1 Main.nc, NONE, 1.1 RealMain.nc, NONE, 1.1
Andreas Lachenmann
lachenmann at users.sourceforge.net
Tue Feb 20 04:33:09 PST 2007
Update of /cvsroot/tinyos/tinyos-1.x/contrib/ustutt/ncunit/mote/internal
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv4808/contrib/ustutt/ncunit/mote/internal
Added Files:
TestStarter.nc Main.nc RealMain.nc
Log Message:
added files to repository
--- NEW FILE: TestStarter.nc ---
/**
* Copyright (c) 2007, Institute of Parallel and Distributed Systems
* (IPVS), Universität Stuttgart.
* 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 names of the Institute of Parallel and Distributed
* Systems and Universität Stuttgart 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 COPYRIGHT
* OWNER OR 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.
*
*/
interface TestStarter {
command void startTest();
event void testCaseStart(char* message);
event void testCaseEnd();
}
--- NEW FILE: Main.nc ---
// $Id: Main.nc,v 1.1 2007/02/20 12:33:07 lachenmann 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: $Id: Main.nc,v 1.1 2007/02/20 12:33:07 lachenmann Exp $
*
*/
/**
* @author Jason Hill
* @author David Gay
* @author Philip Levis
*/
configuration Main {
uses interface StdControl;
}
implementation
{
components RealMain, PotC, HPLInit, TimerC, TestStarterC;
StdControl = RealMain.StdControl;
RealMain.hardwareInit -> HPLInit;
RealMain.Pot -> PotC;
RealMain.TimerControl -> TimerC;
RealMain.Timer -> TimerC.Timer[unique("Timer")];
RealMain.TestStarter -> TestStarterC;
}
--- NEW FILE: RealMain.nc ---
// $Id: RealMain.nc,v 1.1 2007/02/20 12:33:07 lachenmann 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: $Id: RealMain.nc,v 1.1 2007/02/20 12:33:07 lachenmann Exp $
*
*/
/**
* @author Jason Hill
* @author David Gay
* @author Philip Levis
*/
module RealMain {
uses {
command result_t hardwareInit();
interface StdControl;
interface Pot;
interface TestStarter;
interface StdControl as TimerControl;
interface Timer;
}
}
implementation
{
#ifndef TEST_TIMER_INTERVAL
#define TEST_TIMER_INTERVAL 10240
#endif
#include <avr/pgmspace.h>
//somehow needed to store test case number in program memory (workaround)
static const prog_uchar dummy = 1;
event result_t Timer.fired() {
call TestStarter.startTest();
return SUCCESS;
}
static void testStart(char* message) __attribute__((noinline)) {
asm volatile ("nop"::);
}
static void testEnd() __attribute__((noinline)) {
asm volatile ("nop"::);
}
event void TestStarter.testCaseStart(char* message) {
testStart(message);
}
event void TestStarter.testCaseEnd() {
testEnd();
}
int main() __attribute__ ((C, spontaneous)) {
call hardwareInit();
call Pot.init(10);
TOSH_sched_init();
PRG_RDB(&dummy);
call StdControl.init();
call TimerControl.init();
call StdControl.start();
call TimerControl.start();
__nesc_enable_interrupt();
call Timer.start(TIMER_ONE_SHOT, TEST_TIMER_INTERVAL);
while(1) {
TOSH_run_task();
}
}
}
More information about the Tinyos-contrib-commits
mailing list