Virtual block device consists of two mirrored block devices.  
 More...
#include <modm/driver/storage/block_device_mirror.hpp>
 | 
| 
using  | bd_address_t = uint32_t | 
|   | 
| 
using  | bd_size_t = uint32_t | 
|   | 
 | 
| 
bool  | initialize () | 
|   | Initializes the storage hardware. 
  | 
|   | 
| 
bool  | deinitialize () | 
|   | Deinitializes the storage hardware. 
  | 
|   | 
| bool  | read (uint8_t *buffer, bd_address_t address, bd_size_t size) | 
|   | 
| bool  | program (const uint8_t *buffer, bd_address_t address, bd_size_t size) | 
|   | 
| bool  | erase (bd_address_t address, bd_size_t size) | 
|   | 
| bool  | write (const uint8_t *buffer, bd_address_t address, bd_size_t size) | 
|   | 
| BlockDeviceA &  | getBlockDeviceA () | 
|   | 
| BlockDeviceB &  | getBlockDeviceB () | 
|   | 
 | 
| 
static constexpr bd_size_t  | BlockSizeRead = BlockDeviceA::BlockSizeRead | 
|   | 
| 
static constexpr bd_size_t  | BlockSizeWrite = std::max(BlockDeviceA::BlockSizeWrite, BlockDeviceB::BlockSizeWrite) | 
|   | 
| 
static constexpr bd_size_t  | BlockSizeErase = std::max(BlockDeviceA::BlockSizeErase, BlockDeviceB::BlockSizeErase) | 
|   | 
| 
static constexpr bd_size_t  | DeviceSize = std::min(BlockDeviceA::DeviceSize, BlockDeviceB::DeviceSize) | 
|   | 
template<typename BlockDeviceA, typename BlockDeviceB>
class modm::BdMirror< BlockDeviceA, BlockDeviceB >
Virtual block device consists of two mirrored block devices. 
Write operations (erase(), program() and write()) are forwarded to both block devices. Read operations (read()) are only performed on BlockDeviceA.
- Template Parameters
 - 
  
    | BlockDeviceA | First block device of the mirrored block devices  | 
    | BlockDeviceB | Second block device | 
  
   
- Author
 - Raphael Lehmann 
 
 
template<typename BlockDeviceA , typename BlockDeviceB > 
      
        
          | bool modm::BdMirror< BlockDeviceA, BlockDeviceB >::erase  | 
          ( | 
          bd_address_t  | 
          address,  | 
        
        
           | 
           | 
          bd_size_t  | 
          size  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
Erase blocks
The state of an erased block is undefined until it has been programmed
- Parameters
 - 
  
    | address | Address of block to begin erasing  | 
    | size | Size to erase in bytes (multiple of read block size)  | 
  
   
- Returns
 - True on success 
 
 
 
template<typename BlockDeviceA , typename BlockDeviceB > 
  
  
      
        
          | BlockDeviceA& modm::BdMirror< BlockDeviceA, BlockDeviceB >::getBlockDeviceA  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
Direct access to the BlockDeviceA
- Returns
 - BlockDeviceA 
 
 
 
template<typename BlockDeviceA , typename BlockDeviceB > 
  
  
      
        
          | BlockDeviceB& modm::BdMirror< BlockDeviceA, BlockDeviceB >::getBlockDeviceB  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
Direct access to the BlockDeviceB
- Returns
 - BlockDeviceB 
 
 
 
template<typename BlockDeviceA , typename BlockDeviceB > 
      
        
          | bool modm::BdMirror< BlockDeviceA, BlockDeviceB >::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
- Parameters
 - 
  
    | 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)  | 
  
   
- Returns
 - True on success 
 
 
 
template<typename BlockDeviceA , typename BlockDeviceB > 
      
        
          | bool modm::BdMirror< BlockDeviceA, BlockDeviceB >::read  | 
          ( | 
          uint8_t *  | 
          buffer,  | 
        
        
           | 
           | 
          bd_address_t  | 
          address,  | 
        
        
           | 
           | 
          bd_size_t  | 
          size  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
Read data from one or more blocks
- Parameters
 - 
  
    | buffer | Buffer to read data into  | 
    | address | Address to begin reading from  | 
    | size | Size to read in bytes (multiple of read block size)  | 
  
   
- Returns
 - True on success 
 
 
 
template<typename BlockDeviceA , typename BlockDeviceB > 
      
        
          | bool modm::BdMirror< BlockDeviceA, BlockDeviceB >::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 prior to being programmed
- Parameters
 - 
  
    | 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)  | 
  
   
- Returns
 - True on success 
 
 
 
The documentation for this class was generated from the following file: