[Tinyos-2-commits]
CVS: tinyos-2.x/apps/tests/TestRadioPM/lib/serialDebug
SerialDebug.nc, NONE, 1.1.2.1 SerialDebugC.nc, NONE,
1.1.2.1 SerialDebugMsg.h, NONE, 1.1.2.1 SerialDebugP.nc, NONE,
1.1.2.1
Kevin Klues
klueska at users.sourceforge.net
Mon May 15 12:36:11 PDT 2006
- Previous message: [Tinyos-2-commits]
CVS: tinyos-2.x/apps/tests/TestRadioPM/lib/radioPM/types
DutyCycling.h, NONE, 1.1.2.1 LowPowerListening.h, NONE,
1.1.2.1 RadioPm.h, NONE, 1.1.2.1
- Next message: [Tinyos-2-commits]
CVS: tinyos-2.x/apps/tests/TestRadioPM/lib/timeSync
TimeSync.h, NONE, 1.1.2.1 TimeSyncC.nc, NONE,
1.1.2.1 TimeSyncP.nc, NONE, 1.1.2.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/tinyos/tinyos-2.x/apps/tests/TestRadioPM/lib/serialDebug
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv9561/apps/tests/TestRadioPM/lib/serialDebug
Added Files:
Tag: tos-2-resource-pm-eval-cand
SerialDebug.nc SerialDebugC.nc SerialDebugMsg.h
SerialDebugP.nc
Log Message:
Radio Power Management protocol architecture
--- NEW FILE: SerialDebug.nc ---
/*
* "Copyright (c) 2005 Washington University in St. Louis.
* 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 WASHINGTON UNIVERSITY IN ST. LOUIS 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 WASHINGTON
* UNIVERSITY IN ST. LOUIS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* WASHINGTON UNIVERSITY IN ST. LOUIS 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 WASHINGTON UNIVERSITY IN ST. LOUIS HAS NO
* OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
* MODIFICATIONS."
*/
/**
*
* @author Kevin Klues (klueska at cs.wustl.edu)
* @version $Revision: 1.1.2.1 $
* @date $Date: 2006/05/15 19:36:09 $
*/
interface SerialDebug
{
command error_t print(const char* var, uint32_t value);
command error_t flush();
event void flushDone(error_t error);
}
--- NEW FILE: SerialDebugC.nc ---
/*
* "Copyright (c) 2005 Washington University in St. Louis.
* 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 WASHINGTON UNIVERSITY IN ST. LOUIS 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 WASHINGTON
* UNIVERSITY IN ST. LOUIS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* WASHINGTON UNIVERSITY IN ST. LOUIS 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 WASHINGTON UNIVERSITY IN ST. LOUIS HAS NO
* OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
* MODIFICATIONS."
*/
/**
*
* @author Kevin Klues (klueska at cs.wustl.edu)
* @version $Revision: 1.1.2.1 $
* @date $Date: 2006/05/15 19:36:09 $
*/
#include "SerialDebugMsg.h"
configuration SerialDebugC {
provides {
interface Boot;
interface SerialDebug;
}
}
implementation {
components MainC, LedsC;
components SerialActiveMessageC as AMSerial;
components SerialDebugP;
Boot = SerialDebugP.Boot;
SerialDebug = SerialDebugP;
MainC.SoftwareInit -> AMSerial;
SerialDebugP.MainBoot -> MainC;
SerialDebugP.Leds -> LedsC;
SerialDebugP.AMSerialSend -> AMSerial.AMSend[AM_SERIALDEBUGMSG];
SerialDebugP.AMSerialControl -> AMSerial;
SerialDebugP.SerialPacket -> AMSerial;
}
--- NEW FILE: SerialDebugMsg.h ---
/*
* "Copyright (c) 2005 Washington University in St. Louis.
* 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 WASHINGTON UNIVERSITY IN ST. LOUIS 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 WASHINGTON
* UNIVERSITY IN ST. LOUIS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* WASHINGTON UNIVERSITY IN ST. LOUIS 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 WASHINGTON UNIVERSITY IN ST. LOUIS HAS NO
* OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
* MODIFICATIONS."
*/
/**
*
* @author Kevin Klues (klueska at cs.wustl.edu)
* @version $Revision: 1.1.2.1 $
* @date $Date: 2006/05/15 19:36:09 $
*/
#ifndef SERIAL_DEBUG_MSG_H
#define SERIAL_DEBUG_MSG_H
#define SERIAL_DEBUG_VAR_SIZE 8
#define SERIAL_DEBUG_NUM_VARS 5
typedef nx_struct SerialDebugMsg {
nx_uint16_t node_id;
nx_uint8_t num_vars;
nx_uint8_t vars[SERIAL_DEBUG_NUM_VARS][SERIAL_DEBUG_VAR_SIZE];
nx_uint32_t vals[SERIAL_DEBUG_NUM_VARS];
} SerialDebugMsg;
enum {
AM_SERIALDEBUGMSG = 100,
};
#endif //SERIAL_DEBUG_MSG_H
--- NEW FILE: SerialDebugP.nc ---
/*
* "Copyright (c) 2005 Washington University in St. Louis.
* 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 WASHINGTON UNIVERSITY IN ST. LOUIS 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 WASHINGTON
* UNIVERSITY IN ST. LOUIS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* WASHINGTON UNIVERSITY IN ST. LOUIS 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 WASHINGTON UNIVERSITY IN ST. LOUIS HAS NO
* OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
* MODIFICATIONS."
*/
/**
*
* @author Kevin Klues (klueska at cs.wustl.edu)
* @version $Revision: 1.1.2.1 $
* @date $Date: 2006/05/15 19:36:09 $
*/
#include "SerialDebugMsg.h"
module SerialDebugP {
provides {
interface Boot;
interface SerialDebug;
}
uses {
interface Boot as MainBoot;
interface Leds;
interface SplitControl as AMSerialControl;
interface AMSend as AMSerialSend;
interface Packet as SerialPacket;
}
}
implementation {
message_t serialMsg;
bool busy = TRUE;
void strcpy(const char* src, nx_uint8_t* dest, uint8_t length) {
int i;
for(i=0; i<length; i++)
dest[i] = src[i];
}
error_t sendMsg() {
busy = TRUE;
if(call AMSerialSend.send(AM_BROADCAST_ADDR, &serialMsg, sizeof(SerialDebugMsg)) == SUCCESS)
return SUCCESS;
busy = FALSE;
return FAIL;
}
event void MainBoot.booted() {
SerialDebugMsg* m = (SerialDebugMsg*)call SerialPacket.getPayload(&serialMsg, NULL);
memset(m, 0, sizeof(SerialDebugMsg));
call AMSerialControl.start();
}
event void AMSerialControl.startDone(error_t error) {
busy = FALSE;
signal Boot.booted();
}
event void AMSerialControl.stopDone(error_t error) {
}
event void AMSerialSend.sendDone(message_t* msg, error_t error) {
SerialDebugMsg* m = (SerialDebugMsg*)call SerialPacket.getPayload(&serialMsg, NULL);
memset(m, 0, sizeof(SerialDebugMsg));
busy = FALSE;
signal SerialDebug.flushDone(error);
}
command error_t SerialDebug.print(const char* var, uint32_t val) {
SerialDebugMsg* m;
if(busy == TRUE) return FAIL;
m = (SerialDebugMsg*)call SerialPacket.getPayload(&serialMsg, NULL);
if(m->num_vars == SERIAL_DEBUG_NUM_VARS) return FAIL;
strcpy(var, m->vars[m->num_vars], SERIAL_DEBUG_VAR_SIZE);
m->vals[m->num_vars++] = val;
return SUCCESS;
}
command error_t SerialDebug.flush() {
return sendMsg();
}
default event void Boot.booted() {
}
}
- Previous message: [Tinyos-2-commits]
CVS: tinyos-2.x/apps/tests/TestRadioPM/lib/radioPM/types
DutyCycling.h, NONE, 1.1.2.1 LowPowerListening.h, NONE,
1.1.2.1 RadioPm.h, NONE, 1.1.2.1
- Next message: [Tinyos-2-commits]
CVS: tinyos-2.x/apps/tests/TestRadioPM/lib/timeSync
TimeSync.h, NONE, 1.1.2.1 TimeSyncC.nc, NONE,
1.1.2.1 TimeSyncP.nc, NONE, 1.1.2.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Tinyos-2-commits
mailing list