[Tinyos-2-commits] CVS: tinyos-2.x/apps/tests/storage/Block
Makefile, NONE, 1.1.4.2 README.txt, NONE,
1.1.4.2 RandRWAppC.nc, NONE, 1.1.4.2 RandRWC.nc, NONE,
1.1.4.2 volumes-at45db.xml, NONE, 1.1.4.2 volumes-stm25p.xml,
NONE, 1.1.4.2
Kevin Klues
klueska at users.sourceforge.net
Mon May 15 11:35:31 PDT 2006
- Previous message: [Tinyos-2-commits] CVS: tinyos-2.x/doc/html tep121.html, NONE,
1.1.4.2
- Next message: [Tinyos-2-commits] CVS: tinyos-2.x/support/make/tinynode bsl.extra,
NONE, 1.1.4.2 digi.extra, NONE, 1.1.4.2 flash.gdb.in, NONE,
1.1.4.2 gdb.extra, NONE, 1.1.4.2 init.gdb.in, NONE,
1.1.4.2 noflash.extra, NONE, 1.1.4.2 noflash.gdb.in, NONE,
1.1.4.2 tinynode.rules, NONE, 1.1.4.2 xedebug.in, NONE, 1.1.4.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/tinyos/tinyos-2.x/apps/tests/storage/Block
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv18756/apps/tests/storage/Block
Added Files:
Tag: tos-2-resource-pm-eval-cand
Makefile README.txt RandRWAppC.nc RandRWC.nc
volumes-at45db.xml volumes-stm25p.xml
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=RandRWAppC
include $(MAKERULES)
--- NEW FILE: README.txt ---
README for Block
Author/Contact: tinyos-help at millennium.berkeley.edu
Description:
Application to test the BlockStorageC abstraction. There must be a
volumes-<chip>.xml file in this directory describing the test volume
for your flash chip.
Install this application with a moteid of k*4 + 3 to do a full flash test.
If you install with an id of k*4+1, only the write portion of the test will
be performed.
If you install with an id of k*4, data from a previous installation will be
read (the test will fail if you didn't previously install with an id of
k*4+1 or k*4+3).
Different values of k run the test with different initial random seeds
(and test a different pattern of reads/writes).
A successful test will blink the yellow led a few times, then turn on the
green led. A failed test will turn on the red led.
Tools:
Known bugs/limitations:
None.
$Id: README.txt,v 1.1.4.2 2006/05/15 18:35:28 klueska Exp $
--- NEW FILE: RandRWAppC.nc ---
/* $Id: RandRWAppC.nc,v 1.1.4.2 2006/05/15 18:35:28 klueska Exp $
* Copyright (c) 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.
*/
/**
* Block storage test application. Does a pattern of random reads and
* writes, based on mote id. See README.txt for more details.
*
* @author David Gay
*/
#include "StorageVolumes.h"
configuration RandRWAppC { }
implementation {
components RandRWC, new BlockStorageC(VOLUME_BLOCKTEST),
MainC, LedsC, PlatformC, SerialActiveMessageC;
MainC.Boot <- RandRWC;
MainC.SoftwareInit -> SerialActiveMessageC;
RandRWC.SerialControl -> SerialActiveMessageC;
RandRWC.AMSend -> SerialActiveMessageC.AMSend[1];
RandRWC.BlockRead -> BlockStorageC.BlockRead;
RandRWC.BlockWrite -> BlockStorageC.BlockWrite;
RandRWC.Leds -> LedsC;
}
--- NEW FILE: RandRWC.nc ---
/* $Id: RandRWC.nc,v 1.1.4.2 2006/05/15 18:35:28 klueska Exp $
* Copyright (c) 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.
*/
/**
* Block storage test application. Does a pattern of random reads and
* writes, based on mote id. See README.txt for more details.
*
* @author David Gay
*/
/*
address & 3:
0, 2: r
1: w
3: r&w
*/
module RandRWC {
uses {
interface Boot;
interface Leds;
interface BlockRead;
interface BlockWrite;
interface AMSend;
interface SplitControl as SerialControl;
}
}
implementation {
enum {
S_ERASE,
S_WRITE,
S_COMMIT,
S_VERIFY,
S_READ
} state;
enum {
SIZE = 1024L * 256,
NWRITES = SIZE / 4096,
};
uint16_t shiftReg;
uint16_t initSeed;
uint16_t mask;
/* Return the next 16 bit random number */
uint16_t rand() {
bool endbit;
uint16_t tmpShiftReg;
tmpShiftReg = shiftReg;
endbit = ((tmpShiftReg & 0x8000) != 0);
tmpShiftReg <<= 1;
if (endbit)
tmpShiftReg ^= 0x100b;
tmpShiftReg++;
shiftReg = tmpShiftReg;
tmpShiftReg = tmpShiftReg ^ mask;
return tmpShiftReg;
}
void resetSeed() {
shiftReg = 119 * 119 * ((TOS_NODE_ID >> 2) + 1);
initSeed = shiftReg;
mask = 137 * 29 * ((TOS_NODE_ID >> 2) + 1);
}
uint8_t data[512], rdata[512];
int count;
uint32_t addr, len;
uint16_t offset;
message_t reportmsg;
void report(error_t e) {
uint8_t *msg = call AMSend.getPayload(&reportmsg);
msg[0] = e;
if (call AMSend.send(AM_BROADCAST_ADDR, &reportmsg, 1) != SUCCESS)
call Leds.led0On();
}
event void AMSend.sendDone(message_t* msg, error_t error) {
if (error != SUCCESS)
call Leds.led0On();
}
void fail(error_t e) {
call Leds.led0On();
report(e);
}
bool scheck(error_t r) __attribute__((noinline)) {
if (r != SUCCESS)
fail(r);
return r == SUCCESS;
}
bool bcheck(bool b) {
if (!b)
fail(FAIL);
return b;
}
void setParameters() {
addr = (uint32_t)count << 12 | (rand() >> 6);
len = rand() >> 7;
if (addr + len > SIZE)
addr = SIZE - len;
offset = rand() >> 8;
if (offset + len > sizeof data)
offset = sizeof data - len;
}
event void Boot.booted() {
call SerialControl.start();
}
event void SerialControl.stopDone(error_t e) { }
event void SerialControl.startDone(error_t e) {
int i;
if (e != SUCCESS)
{
call Leds.led0On();
return;
}
resetSeed();
for (i = 0; i < sizeof data; i++)
data[i++] = rand() >> 8;
if (TOS_NODE_ID & 1)
{
state = S_ERASE;
scheck(call BlockWrite.erase());
}
else
{
state = S_VERIFY;
scheck(call BlockRead.verify());
}
}
void nextRead() {
if (++count == NWRITES)
{
call Leds.led1On();
report(0xc0);
}
else
{
setParameters();
scheck(call BlockRead.read(addr, rdata, len));
}
}
void nextWrite() {
if (++count == NWRITES)
{
call Leds.led2Toggle();
state = S_COMMIT;
scheck(call BlockWrite.commit());
}
else
{
setParameters();
scheck(call BlockWrite.write(addr, data + offset, len));
}
}
event void BlockWrite.writeDone(storage_addr_t x, void* buf, storage_len_t y, error_t result) {
if (scheck(result))
nextWrite();
}
event void BlockWrite.eraseDone(error_t result) {
if (scheck(result))
{
call Leds.led2Toggle();
state = S_WRITE;
count = 0;
resetSeed();
nextWrite();
}
}
event void BlockWrite.commitDone(error_t result) {
if (scheck(result))
{
if (TOS_NODE_ID & 2)
{
call Leds.led2Toggle();
state = S_VERIFY;
scheck(call BlockRead.verify());
}
else
{
call Leds.led1On();
report(0x80);
}
}
}
event void BlockRead.readDone(storage_addr_t x, void* buf, storage_len_t rlen, error_t result) __attribute__((noinline)) {
if (scheck(result) && bcheck(x == addr && rlen == len && buf == rdata &&
memcmp(data + offset, rdata, rlen) == 0))
nextRead();
}
event void BlockRead.verifyDone(error_t result) {
if (scheck(result))
{
call Leds.led2Toggle();
state = S_READ;
count = 0;
resetSeed();
nextRead();
}
}
event void BlockRead.computeCrcDone(storage_addr_t x, storage_len_t y, uint16_t z, error_t result) {
}
}
--- NEW FILE: volumes-at45db.xml ---
<volume_table>
<volume name="BLOCKTEST" size="262144"/>
</volume_table>
--- NEW FILE: volumes-stm25p.xml ---
<volume_table>
<volume name="BLOCKTEST" size="262144"/>
</volume_table>
- Previous message: [Tinyos-2-commits] CVS: tinyos-2.x/doc/html tep121.html, NONE,
1.1.4.2
- Next message: [Tinyos-2-commits] CVS: tinyos-2.x/support/make/tinynode bsl.extra,
NONE, 1.1.4.2 digi.extra, NONE, 1.1.4.2 flash.gdb.in, NONE,
1.1.4.2 gdb.extra, NONE, 1.1.4.2 init.gdb.in, NONE,
1.1.4.2 noflash.extra, NONE, 1.1.4.2 noflash.gdb.in, NONE,
1.1.4.2 tinynode.rules, NONE, 1.1.4.2 xedebug.in, NONE, 1.1.4.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Tinyos-2-commits
mailing list