VitroIO SDK
Software development kit for Vitro Shard.
Loading...
Searching...
No Matches
vitroio::sdk::impl::FlashInterface Class Reference

Class is a wrapper for mbed::FlashIAP module. More...

#include <flash_interface.h>

Inheritance diagram for vitroio::sdk::impl::FlashInterface:
Collaboration diagram for vitroio::sdk::impl::FlashInterface:

Public Member Functions

 FlashInterface ()
 Constructor initializes the interface. More...
 
 ~FlashInterface ()
 Destructor. More...
 
bool isValid () const
 Function allows to check whether the interface is in valid state. More...
 
int read (void *buffer, uint32_t offset, uint32_t size)
 Function reads data from flash memory. More...
 
int write (void *buffer, uint32_t offset, uint32_t size)
 Function writes data to flash memory. More...
 
uint32_t getMaxSectorSize () const
 Function allows to obtain maximum size of sector in flash memory. More...
 
uint32_t getSectorSize (uint32_t offset) const
 Function allows to obtain sector size of flash memory for specified address. More...
 
uint32_t getFlashStartAddress () const
 Function allows to obtain flash memory start address. More...
 
uint32_t getFlashSize () const
 Function allows to obtain flash memory size in bytes. More...
 

Detailed Description

Class is a wrapper for mbed::FlashIAP module.

Constructor & Destructor Documentation

◆ FlashInterface()

vitroio::sdk::impl::FlashInterface::FlashInterface ( )
explicit

Constructor initializes the interface.

There is not guarantee that the object is in valid state. User should call isValid() method to determine if the object was initialized successfully. When the object is in invalid state, the behaviour is undefined.

◆ ~FlashInterface()

vitroio::sdk::impl::FlashInterface::~FlashInterface ( )

Destructor.

Member Function Documentation

◆ getFlashSize()

uint32_t vitroio::sdk::impl::FlashInterface::getFlashSize ( ) const

Function allows to obtain flash memory size in bytes.

◆ getFlashStartAddress()

uint32_t vitroio::sdk::impl::FlashInterface::getFlashStartAddress ( ) const

Function allows to obtain flash memory start address.

◆ getMaxSectorSize()

uint32_t vitroio::sdk::impl::FlashInterface::getMaxSectorSize ( ) const

Function allows to obtain maximum size of sector in flash memory.

Function can be helpful during operations on flash memory. It can help avoid reallocating of memory - only buffer of maximum sector size can be allocated and reused.

Returns
Function returns maximum size of sector in flash memory.

◆ getSectorSize()

uint32_t vitroio::sdk::impl::FlashInterface::getSectorSize ( uint32_t  offset) const

Function allows to obtain sector size of flash memory for specified address.

Parameters
offsetFlash memory offset.
Returns
Function returns sector size in bytes or 0 if not mapped.

◆ isValid()

bool vitroio::sdk::impl::FlashInterface::isValid ( ) const

Function allows to check whether the interface is in valid state.

Note
This method should be called always after creation of the object.
Returns
Function returns true if the object is valid or false otherwise.

◆ read()

int vitroio::sdk::impl::FlashInterface::read ( void *  buffer,
uint32_t  offset,
uint32_t  size 
)

Function reads data from flash memory.

Parameters
bufferBuffer where the data are to be write to.
offsetOffset of the flash memory where the data are to be read from.
sizeSize of the data to read.
Returns
Function returns VITROIO_ERR_SUCCESS on success or appropriate error code otherwise.

◆ write()

int vitroio::sdk::impl::FlashInterface::write ( void *  buffer,
uint32_t  offset,
uint32_t  size 
)

Function writes data to flash memory.

Parameters
bufferBuffer with data to write.
offsetOffset of the flash memory where the data are to be write to.
sizeSize of the data to write.
Returns
Function returns VITROIO_ERR_SUCCESS on success or appropriate error code otherwise.