|
modm API documentation
|
#include <modm/architecture/interface/block_device.hpp>
Public Typedefs | |
| using | bd_address_t = uint32_t |
| using | bd_size_t = uint32_t |
Public Member Functions | |
| BlockDevice (const BlockDevice &) = delete | |
| BlockDevice & | operator= (const BlockDevice &) = delete |
| modm::ResumableResult< bool > | initialize () |
| Initializes the storage hardware. | |
| modm::ResumableResult< bool > | deinitialize () |
| Deinitializes the storage hardware. | |
| modm::ResumableResult< bool > | read (uint8_t *buffer, bd_address_t address, bd_size_t size) |
| modm::ResumableResult< bool > | program (const uint8_t *buffer, bd_address_t address, bd_size_t size) |
| modm::ResumableResult< bool > | erase (bd_address_t address, bd_size_t size) |
| modm::ResumableResult< bool > | write (const uint8_t *buffer, bd_address_t address, bd_size_t size) |
Static Public Attributes | |
| static constexpr bd_size_t | BlockSizeRead = 1 |
| static constexpr bd_size_t | BlockSizeWrite = 1 |
| static constexpr bd_size_t | BlockSizeErase = 1 |
Interface of a Block Device
Access to storage devices like flash chips
| modm::ResumableResult<bool> modm::BlockDevice::erase | ( | bd_address_t | address, |
| bd_size_t | size | ||
| ) |
Erase blocks
The state of an erased block is undefined until it has been programmed
| address | Address of block to begin erasing |
| size | Size to erase in bytes (multiple of read block size) |
| modm::ResumableResult<bool> modm::BlockDevice::program | ( | const uint8_t * | buffer, |
| bd_address_t | address, | ||
| bd_size_t | size | ||
| ) |
Program blocks with data
Any block has to be erased prior to being programmed
| buffer | Buffer of data to write to blocks |
| address | Address of first block to begin writing to |
| size | Size to write in bytes (multiple of read block size) |
| modm::ResumableResult<bool> modm::BlockDevice::read | ( | uint8_t * | buffer, |
| bd_address_t | address, | ||
| bd_size_t | size | ||
| ) |
Read data from one or more blocks
| buffer | Buffer to read data into |
| address | Address to begin reading from |
| size | Size to read in bytes (multiple of read block size) |
| modm::ResumableResult<bool> modm::BlockDevice::write | ( | const uint8_t * | buffer, |
| bd_address_t | address, | ||
| bd_size_t | size | ||
| ) |
Writes data to one or more blocks after erasing them
The blocks are erased proir to being programmed
| buffer | Buffer of data to write to blocks |
| address | Address of first block to begin writing to |
| size | Size to write in bytes (multiple of read block size) |
|
staticconstexpr |