|
There could be several issues
here.
First, how are you wiring up your
component? You should do something like this:
// in a header file, included to your
configuration:
enum {
BLOCKSTORAGE_MYCOMPONENT =
unique("BlockStorage"),
}
// In your configuration:
MyComponent.Mount ->
BlockStorageC.Mount[BLOCKSTORAGE_MYCOMPONENT];
MyComponent.BlockWrite ->
BlockStorageC.BlockWrite[BLOCKSTORAGE_MYCOMPONENT];
MyComponent.BlockRead ->
BlockStorageC.BlockRead[BLOCKSTORAGE_MYCOMPONENT];
Without doing it this way, your components may
be accessing separate or invalid parameterized interfaces to the BlockStorage
interface. That means when you do a Mount, you'd be mounting
only one of the 3 parameterized interfaces. Then when you're trying to
write, you'd be writing to a different parameterized interface than the one
that's mounted. Defining only one unique("BlockStorage")
interface and then using that one throughout your component is the only way to
do it.
Finally, keep in mind
the parameters to the command are BlockWrite.write(uint32_t addr, void *buf,
uint32_t len). So your code should be looking something
like:
// Define a buffer, we'll make it a page
long
uint8_t myBuffer[256];
// After your mount gets
done...
event void Mount.mountDone(...)
{
// now you can interact with
BlockStorage
// write 10 bytes from myBuffer into
flash starting at address 0x0:
call BlockWrite.write(0x0, &myBuffer,
10);
}
event void BlockWrite.writeDone(...)
{
// Tada, your data exists on
flash
}
-David
|
_______________________________________________ Tinyos-help mailing list [email protected] https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
