Interface: moteiv.tos.lib.Flash.BlockRead

interface BlockRead

Read interface for the block storage abstraction described in TEP103.

Author:
Jonathan Hui <jwhui@cs.berkeley.edu>

Commands
command result_t computeCrc(block_addr_t addr, block_addr_t len) Initiate a crc computation.
command block_addr_t getSize() Report volume size in bytes.
command result_t read(block_addr_t addr, void *buf, block_addr_t len) Initiate a read operation within a given volume.
command result_t verify() Initiate a verify operation to verify the integrity of the data.

Events
event void computeCrcDone(storage_result_t result, uint16_t crc, block_addr_t addr, block_addr_t len) Signals the completion of a crc computation.
event void readDone(storage_result_t result, block_addr_t addr, void *buf, block_addr_t len) Signals the completion of a read operation.
event void verifyDone(storage_result_t result) Signals the completion of a verify operation.

Commands - Details

computeCrc

command result_t computeCrc(block_addr_t addr, block_addr_t len)

Initiate a crc computation. On SUCCESS, the computeCrcDone event will signal completion of the operation.

Parameters:
addr - starting address.
len - the number of bytes to compute the crc over.
Returns:
SUCCESS if the request was accepted, FAIL otherwise.

getSize

command block_addr_t getSize()

Report volume size in bytes.

Returns:
Volume size.

read

command result_t read(block_addr_t addr, void *buf, block_addr_t len)

Initiate a read operation within a given volume. On SUCCESS, the readDone event will signal completion of the operation.

Parameters:
addr - starting address to begin reading.
buf - buffer to place read data.
len - number of bytes to read.
Returns:
SUCCESS if the request was accepted, FAIL otherwise.

verify

command result_t verify()

Initiate a verify operation to verify the integrity of the data. This operation is only valid after a commit operation from BlockWrite has been completed. On SUCCESS, the verifyDone event will signal completion of the operation.

Returns:
SUCCESS if the request was accepted, FAIL otherwise.

Events - Details

computeCrcDone

event void computeCrcDone(storage_result_t result, uint16_t crc, block_addr_t addr, block_addr_t len)

Signals the completion of a crc computation.

Parameters:
addr - stating address.
len - number of bytes the crc was computed over.
crc - the resulting crc value.
result - notification of how the operation went.

readDone

event void readDone(storage_result_t result, block_addr_t addr, void *buf, block_addr_t len)

Signals the completion of a read operation.

Parameters:
addr - starting address of read.
buf - buffer where read data was placed.
len - number of bytes read.
result - notification of how the operation went.

verifyDone

event void verifyDone(storage_result_t result)

Signals the completion of a verify operation.

Parameters:
error - notification of how the operation went.