Interface: tos.interfaces.InternalFlash

interface InternalFlash

A generic interface to read from and write to the internal flash of a microcontroller.

Author:
Jonathan Hui <jwhui@cs.berkeley.edu>
Prabal Dutta <prabal@cs.berkeley.edu> (Port to T2)

Commands
command error_t read(void *addr, void *buf, uint16_t size) Read size bytes starting from addr and return them in buf.
command error_t write(void *addr, void *buf, uint16_t size) Write size bytes from buf into internal flash starting at addr.

Commands - Details

read

command error_t read(void *addr, void *buf, uint16_t size)

Read size bytes starting from addr and return them in buf.

Parameters:
addr - A pointer to the starting address from which to read.
'void* COUNT(size) buf' A pointer to the buffer into which read bytes are placed.
size - The number of bytes to read.
Returns:
SUCCESS if the bytes were successfully read. FAIL if the call could not be completed.

write

command error_t write(void *addr, void *buf, uint16_t size)

Write size bytes from buf into internal flash starting at addr.

Parameters:
addr - A pointer to the starting address to which to write.
'void* COUNT(size) buf' A pointer to the buffer from which bytes are read.
size - The number of bytes to write.
Returns:
SUCCESS if the bytes were successfully written. FAIL if the call could not be completed.