distortos  v0.7.0
object-oriented C++ RTOS for microcontrollers
MemoryTechnologyDevice.hpp
Go to the documentation of this file.
1 
12 #ifndef INCLUDE_DISTORTOS_DEVICES_MEMORY_MEMORYTECHNOLOGYDEVICE_HPP_
13 #define INCLUDE_DISTORTOS_DEVICES_MEMORY_MEMORYTECHNOLOGYDEVICE_HPP_
14 
15 #include <cstddef>
16 #include <cstdint>
17 
18 namespace distortos
19 {
20 
21 namespace devices
22 {
23 
31 {
32 public:
33 
40  virtual ~MemoryTechnologyDevice() = default;
41 
53  virtual int close() = 0;
54 
68  virtual int erase(uint64_t address, uint64_t size) = 0;
69 
74  virtual size_t getEraseBlockSize() const = 0;
75 
80  virtual size_t getProgramBlockSize() const = 0;
81 
86  virtual size_t getReadBlockSize() const = 0;
87 
92  virtual uint64_t getSize() const = 0;
93 
109  virtual void lock() = 0;
110 
119  virtual int open() = 0;
120 
137  virtual int program(uint64_t address, const void* buffer, size_t size) = 0;
138 
153  virtual int read(uint64_t address, void* buffer, size_t size) = 0;
154 
163  virtual int synchronize() = 0;
164 
175  virtual void unlock() = 0;
176 
177  MemoryTechnologyDevice() = default;
179  MemoryTechnologyDevice& operator=(const MemoryTechnologyDevice&) = delete;
180 };
181 
182 } // namespace devices
183 
184 } // namespace distortos
185 
186 #endif // INCLUDE_DISTORTOS_DEVICES_MEMORY_MEMORYTECHNOLOGYDEVICE_HPP_
virtual int erase(uint64_t address, uint64_t size)=0
Erases blocks on a device.
virtual size_t getProgramBlockSize() const =0
virtual size_t getEraseBlockSize() const =0
virtual ~MemoryTechnologyDevice()=default
MemoryTechnologyDevice's destructor.
virtual void lock()=0
Locks the device for exclusive use by current thread.
Definition: MemoryTechnologyDevice.hpp:30
virtual uint64_t getSize() const =0
virtual int read(uint64_t address, void *buffer, size_t size)=0
Reads data from a device.
virtual void unlock()=0
Unlocks the device which was previously locked by current thread.
Top-level namespace of distortos project.
Definition: buttons.hpp:33
virtual int close()=0
Closes device.
virtual size_t getReadBlockSize() const =0
virtual int program(uint64_t address, const void *buffer, size_t size)=0
Programs data to a device.
virtual int open()=0
Opens device.
virtual int synchronize()=0
Synchronizes state of a device, ensuring all cached writes are finished.