[Tinyos-2-commits] CVS: tinyos-2.x/tos/system NoLedsC.nc, 1.4, 1.5 RandomLfsrC.nc, 1.2, 1.3 RandomMlcgC.nc, 1.2, 1.3 NoLedsP.nc, 1.4, NONE RandomLfsrP.nc, 1.4, NONE RandomMlcgP.nc, 1.2, NONE
David Gay
idgay at users.sourceforge.net
Fri May 2 12:54:17 PDT 2008
Update of /cvsroot/tinyos/tinyos-2.x/tos/system
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv9347
Modified Files:
NoLedsC.nc RandomLfsrC.nc RandomMlcgC.nc
Removed Files:
NoLedsP.nc RandomLfsrP.nc RandomMlcgP.nc
Log Message:
remove useless wrappers
Index: NoLedsC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/system/NoLedsC.nc,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** NoLedsC.nc 12 Dec 2006 18:23:47 -0000 1.4
--- NoLedsC.nc 2 May 2008 19:54:15 -0000 1.5
***************
*** 32,44 ****
*/
!
! configuration NoLedsC {
provides interface Init;
provides interface Leds;
}
implementation {
- components NoLedsP;
- Init = NoLedsP;
- Leds = NoLedsP;
- }
--- 32,56 ----
*/
! module NoLedsC {
provides interface Init;
provides interface Leds;
}
implementation {
+ command error_t Init.init() {return SUCCESS;}
+
+ async command void Leds.led0On() {}
+ async command void Leds.led0Off() {}
+ async command void Leds.led0Toggle() {}
+
+ async command void Leds.led1On() {}
+ async command void Leds.led1Off() {}
+ async command void Leds.led1Toggle() {}
+
+ async command void Leds.led2On() {}
+ async command void Leds.led2Off() {}
+ async command void Leds.led2Toggle() {}
+
+ async command uint8_t Leds.get() {return 0;}
+ async command void Leds.set(uint8_t val) {}
+ }
Index: RandomLfsrC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/system/RandomLfsrC.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** RandomLfsrC.nc 12 Jul 2006 17:03:20 -0000 1.2
--- RandomLfsrC.nc 2 May 2008 19:54:15 -0000 1.3
***************
*** 1,2 ****
--- 1,4 ----
+ // $Id$
+
/* tab:4
* "Copyright (c) 2000-2003 The Regents of the University of California.
***************
*** 26,45 ****
* Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA,
* 94704. Attention: Intel License Inquiry.
*
- * Date last modified: 6/25/02
*/
/**
* This is a 16 bit Linear Feedback Shift Register pseudo random number
! * generator. It is faster than the MLCG generator but does not generate
! * nearly as good random numbers.
*
- * @author Philip Levis
- * @author David Gay
* @author Alec Woo
! * @date Jan 20 2005
*/
! configuration RandomLfsrC
{
provides interface Init;
--- 28,52 ----
* Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA,
* 94704. Attention: Intel License Inquiry.
+ */
+
+ /*
+ *
+ * Authors: Alec Woo, David Gay, Philip Levis
+ * Date last modified: 8/8/05
*
*/
/**
* This is a 16 bit Linear Feedback Shift Register pseudo random number
! generator. It is faster than the MLCG generator, but the numbers generated
! * have less randomness.
*
* @author Alec Woo
! * @author David Gay
! * @author Philip Levis
! * @date August 8 2005
*/
! module RandomLfsrC
{
provides interface Init;
***************
*** 48,54 ****
implementation
{
! components RandomLfsrP;
! Init = RandomLfsrP;
! Random = RandomLfsrP;
}
--- 55,91 ----
implementation
{
! uint16_t shiftReg;
! uint16_t initSeed;
! uint16_t mask;
! /* Initialize the seed from the ID of the node */
! command error_t Init.init() {
! atomic {
! shiftReg = 119 * 119 * (TOS_NODE_ID + 1);
! initSeed = shiftReg;
! mask = 137 * 29 * (TOS_NODE_ID + 1);
! }
! return SUCCESS;
! }
!
! /* Return the next 16 bit random number */
! async command uint16_t Random.rand16() {
! bool endbit;
! uint16_t tmpShiftReg;
! atomic {
! tmpShiftReg = shiftReg;
! endbit = ((tmpShiftReg & 0x8000) != 0);
! tmpShiftReg <<= 1;
! if (endbit)
! tmpShiftReg ^= 0x100b;
! tmpShiftReg++;
! shiftReg = tmpShiftReg;
! tmpShiftReg = tmpShiftReg ^ mask;
! }
! return tmpShiftReg;
! }
!
! async command uint32_t Random.rand32() {
! return (uint32_t)call Random.rand16() << 16 | call Random.rand16();
! }
}
Index: RandomMlcgC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/system/RandomMlcgC.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** RandomMlcgC.nc 12 Jul 2006 17:03:20 -0000 1.2
--- RandomMlcgC.nc 2 May 2008 19:54:15 -0000 1.3
***************
*** 19,44 ****
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
*/
!
! /**
! * This is the configuration for RandomMlcgC, a
! * multiplicative linear congruential generator.
*
! * @author Barbara Hohlt
! * @author Philip Levis
! * @date March 1 2005
*/
! configuration RandomMlcgC {
provides interface Init;
provides interface ParameterInit<uint16_t> as SeedInit;
! provides interface Random as Random;
}
! implementation {
! components RandomMlcgP;
! Init = RandomMlcgP;
! SeedInit = RandomMlcgP;
! Random = RandomMlcgP;
! }
--- 19,88 ----
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
*/
! /** This code is a fast implementation of the Park-Miller Minimal Standard
! * Generator for pseudo-random numbers. It uses the 32 bit multiplicative
! * linear congruential generator,
*
! * S' = (A x S) mod (2^31 - 1)
! *
! * for A = 16807.
! *
! *
! * @author Barbara Hohlt
! * @date March 1 2005
*/
! module RandomMlcgC {
provides interface Init;
provides interface ParameterInit<uint16_t> as SeedInit;
! provides interface Random;
}
+ implementation
+ {
+ uint32_t seed ;
! /* Initialize the seed from the ID of the node */
! command error_t Init.init() {
! atomic seed = (uint32_t)(TOS_NODE_ID + 1);
!
! return SUCCESS;
! }
! /* Initialize with 16-bit seed */
! command error_t SeedInit.init(uint16_t s) {
! atomic seed = (uint32_t)(s + 1);
!
! return SUCCESS;
! }
! /* Return the next 32 bit random number */
! async command uint32_t Random.rand32() {
! uint32_t mlcg,p,q;
! uint64_t tmpseed;
! atomic
! {
! tmpseed = (uint64_t)33614U * (uint64_t)seed;
! q = tmpseed; /* low */
! q = q >> 1;
! p = tmpseed >> 32 ; /* hi */
! mlcg = p + q;
! if (mlcg & 0x80000000) {
! mlcg = mlcg & 0x7FFFFFFF;
! mlcg++;
! }
! seed = mlcg;
! }
! return mlcg;
! }
!
! /* Return low 16 bits of next 32 bit random number */
! async command uint16_t Random.rand16() {
! return (uint16_t)call Random.rand32();
! }
!
! #if 0
! /* Return high 16 bits of 32 bit number */
! inline uint16_t getHigh16(uint32_t num) {
! return num >> 16;
! }
! #endif
! }
--- NoLedsP.nc DELETED ---
--- RandomLfsrP.nc DELETED ---
--- RandomMlcgP.nc DELETED ---
More information about the Tinyos-2-commits
mailing list