#include "distortos/devices/memory/MemoryTechnologyDevice.hpp"
MemoryTechnologyDevice class is an interface for a memory technology device (flash memory).
◆ ~MemoryTechnologyDevice()
virtual distortos::devices::MemoryTechnologyDevice::~MemoryTechnologyDevice |
( |
| ) |
|
|
virtualdefault |
◆ close()
virtual int distortos::devices::MemoryTechnologyDevice::close |
( |
| ) |
|
|
pure virtual |
Closes device.
- Note
- Even if error code is returned, the device must not be used from the context which opened it (until it is successfully opened again).
- Precondition
- Device is opened.
- Returns
- 0 on success, error code otherwise
Implemented in distortos::devices::BlockDeviceToMemoryTechnologyDevice.
◆ erase()
virtual int distortos::devices::MemoryTechnologyDevice::erase |
( |
uint64_t |
address, |
|
|
uint64_t |
size |
|
) |
| |
|
pure virtual |
Erases blocks on a device.
- Precondition
- Device is opened.
-
address and size are valid.
-
Selected range is within address space of device.
- Parameters
-
[in] | address | is the address of range that will be erased, must be a multiple of erase block size |
[in] | size | is the size of erased range, bytes, must be a multiple of erase block size |
- Returns
- 0 on success, error code otherwise
Implemented in distortos::devices::BlockDeviceToMemoryTechnologyDevice.
◆ getEraseBlockSize()
virtual size_t distortos::devices::MemoryTechnologyDevice::getEraseBlockSize |
( |
| ) |
const |
|
pure virtual |
◆ getProgramBlockSize()
virtual size_t distortos::devices::MemoryTechnologyDevice::getProgramBlockSize |
( |
| ) |
const |
|
pure virtual |
◆ getReadBlockSize()
virtual size_t distortos::devices::MemoryTechnologyDevice::getReadBlockSize |
( |
| ) |
const |
|
pure virtual |
◆ getSize()
virtual uint64_t distortos::devices::MemoryTechnologyDevice::getSize |
( |
| ) |
const |
|
pure virtual |
◆ lock()
virtual void distortos::devices::MemoryTechnologyDevice::lock |
( |
| ) |
|
|
pure virtual |
Locks the device for exclusive use by current thread.
When the object is locked, any call to any member function from other thread will be blocked until the object is unlocked. Locking is optional, but may be useful when more than one transaction must be done atomically.
- Note
- Locks are recursive.
- Warning
- This function must not be called from interrupt context!
- Precondition
- The number of recursive locks of device is less than 65535.
- Postcondition
- Device is locked.
Implemented in distortos::devices::BlockDeviceToMemoryTechnologyDevice.
◆ open()
virtual int distortos::devices::MemoryTechnologyDevice::open |
( |
| ) |
|
|
pure virtual |
◆ program()
virtual int distortos::devices::MemoryTechnologyDevice::program |
( |
uint64_t |
address, |
|
|
const void * |
buffer, |
|
|
size_t |
size |
|
) |
| |
|
pure virtual |
Programs data to a device.
Selected range of blocks must have been erased prior to being programmed.
- Precondition
- Device is opened.
-
address and buffer and size are valid.
-
Selected range is within address space of device.
- Parameters
-
[in] | address | is the address of data that will be programmed, must be a multiple of program block size |
[in] | buffer | is the buffer with data that will be programmed, must be valid |
[in] | size | is the size of buffer, bytes, must be a multiple of program block size |
- Returns
- 0 on success, error code otherwise
Implemented in distortos::devices::BlockDeviceToMemoryTechnologyDevice.
◆ read()
virtual int distortos::devices::MemoryTechnologyDevice::read |
( |
uint64_t |
address, |
|
|
void * |
buffer, |
|
|
size_t |
size |
|
) |
| |
|
pure virtual |
Reads data from a device.
- Precondition
- Device is opened.
-
address and buffer and size are valid.
-
Selected range is within address space of device.
- Parameters
-
[in] | address | is the address of data that will be read, must be a multiple of read block size |
[out] | buffer | is the buffer into which the data will be read, must be valid |
[in] | size | is the size of buffer, bytes, must be a multiple of read block size |
- Returns
- 0 on success, error code otherwise
Implemented in distortos::devices::BlockDeviceToMemoryTechnologyDevice.
◆ synchronize()
virtual int distortos::devices::MemoryTechnologyDevice::synchronize |
( |
| ) |
|
|
pure virtual |
◆ unlock()
virtual void distortos::devices::MemoryTechnologyDevice::unlock |
( |
| ) |
|
|
pure virtual |
Unlocks the device which was previously locked by current thread.
- Note
- Locks are recursive.
- Warning
- This function must not be called from interrupt context!
- Precondition
- This function is called by the thread that locked the device.
Implemented in distortos::devices::BlockDeviceToMemoryTechnologyDevice.
The documentation for this class was generated from the following file: