Interface: tos.interfaces.BlockRead

interface BlockRead

Commands
command error_t computeCrc(storage_addr_t addr, storage_len_t len, uint16_t crc) Initiate a crc computation.
command storage_len_t getSize() Report the usable volume size in bytes (this may be different than the actual volume size because of metadata overheads).
command error_t read(storage_addr_t addr, void *buf, storage_len_t len) Initiate a read operation within a given volume.

Events
event void computeCrcDone(storage_addr_t addr, storage_len_t len, uint16_t crc, error_t error) Signals the completion of a crc computation.
event void readDone(storage_addr_t addr, void *buf, storage_len_t len, error_t error) Signals the completion of a read operation.

Commands - Details

computeCrc

command error_t computeCrc(storage_addr_t addr, storage_len_t len, uint16_t crc)

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.
Parm:
crc initial CRC value
Returns:
  • SUCCESS if the request was accepted,
  • EINVAL if the parameters are invalid
  • EBUSY if a request is already being processed.

  • getSize

    command storage_len_t getSize()

    Report the usable volume size in bytes (this may be different than the actual volume size because of metadata overheads).

    Returns:
    Volume size.

    read

    command error_t read(storage_addr_t addr, void *buf, storage_len_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.
    'void* COUNT(len) buf' buffer to place read data.
    len - number of bytes to read.
    Returns:
  • SUCCESS if the request was accepted,
  • EINVAL if the parameters are invalid
  • EBUSY if a request is already being processed.
  • Events - Details

    computeCrcDone

    event void computeCrcDone(storage_addr_t addr, storage_len_t len, uint16_t crc, error_t error)

    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.
    error - SUCCESS if the operation was successful, FAIL if it failed

    readDone

    event void readDone(storage_addr_t addr, void *buf, storage_len_t len, error_t error)

    Signals the completion of a read operation.

    Parameters:
    addr - starting address of read.
    'void* COUNT(len) buf' buffer where read data was placed.
    len - number of bytes read.
    error - SUCCESS if the operation was successful, FAIL if it failed