#include <Flash.hh>
|
| Device (uint32_t bytes, uint16_t count) |
|
virtual bool | begin () |
|
virtual bool | end () |
|
virtual bool | is_ready ()=0 |
|
virtual int | read (void *dest, uint32_t src, size_t size)=0 |
|
virtual int | erase (uint32_t dest, uint8_t size)=0 |
|
virtual int | write (uint32_t dest, const void *src, size_t size)=0 |
|
virtual int | write_P (uint32_t dest, const void *scr, size_t size)=0 |
|
Cosa Flash memory device driver interface.
Definition at line 31 of file Flash.hh.
Flash::Device::Device |
( |
uint32_t |
bytes, |
|
|
uint16_t |
count |
|
) |
| |
|
inline |
Construct flash memory device driver with given sector size and count.
- Parameters
-
[in] | size | of sector in bytes. |
[in] | count | number of sector. |
Definition at line 54 of file Flash.hh.
virtual bool Flash::Device::begin |
( |
| ) |
|
|
inlinevirtual |
Initiate the flash memory device driver. Return true(1) if the successful otherwise false(0).
- Returns
- bool.
Reimplemented in S25FL127S, and W25X40CL.
Definition at line 67 of file Flash.hh.
virtual bool Flash::Device::end |
( |
| ) |
|
|
inlinevirtual |
Terminate the flash memory device driver. Return true(1) if the successful otherwise false(0).
- Returns
- bool.
Definition at line 78 of file Flash.hh.
virtual int Flash::Device::erase |
( |
uint32_t |
dest, |
|
|
uint8_t |
size |
|
) |
| |
|
pure virtual |
Erase given flash block for given byte address. The actual sector and number of bytes in sector is defined by the implementation device. Returs zero(0) if successful otherwise an negative error code(-1).
- Parameters
-
[in] | dest | destination block byte address to erase. |
[in] | size | of sector to erase in Kbyte. |
- Returns
- zero or negative error code.
Implemented in S25FL127S, and W25X40CL.
virtual bool Flash::Device::is_ready |
( |
| ) |
|
|
pure virtual |
Return true(1) if the device is ready, write cycle is completed, otherwise false(0).
- Returns
- bool.
Implemented in S25FL127S, and W25X40CL.
virtual int Flash::Device::read |
( |
void * |
dest, |
|
|
uint32_t |
src, |
|
|
size_t |
size |
|
) |
| |
|
pure virtual |
Read flash block with the given size into the buffer from the source address. Return number of bytes read or negative error code.
- Parameters
-
[in] | dest | buffer to read from flash into. |
[in] | src | address in flash to read from. |
[in] | size | number of bytes to read. |
- Returns
- number of bytes or negative error code.
Implemented in S25FL127S, and W25X40CL.
virtual int Flash::Device::write |
( |
uint32_t |
dest, |
|
|
const void * |
src, |
|
|
size_t |
size |
|
) |
| |
|
pure virtual |
Write flash block at given destination address with the contents of the source buffer. Return number of bytes written or negative error code.
- Parameters
-
[in] | dest | address in flash to write to. |
[in] | src | buffer to write to flash. |
[in] | size | number of bytes to write. |
- Returns
- number of bytes or negative error code.
Implemented in S25FL127S, and W25X40CL.
virtual int Flash::Device::write_P |
( |
uint32_t |
dest, |
|
|
const void * |
scr, |
|
|
size_t |
size |
|
) |
| |
|
pure virtual |
Write flash block at given destination address with contents of the source buffer in program memory. Return number of bytes written or negative error code.
- Parameters
-
[in] | dest | address in flash to write to. |
[in] | src | buffer in program memory to write to flash. |
[in] | size | number of bytes to write. |
- Returns
- number of bytes written or EOF(-1).
Implemented in S25FL127S, and W25X40CL.
const uint32_t Flash::Device::DEFAULT_SECTOR_BYTES = 4096 |
|
static |
Default size of sector in bytes.
Definition at line 37 of file Flash.hh.
const uint32_t Flash::Device::DEVICE_BYTES |
Number of bytes of device.
Definition at line 46 of file Flash.hh.
const uint32_t Flash::Device::SECTOR_BYTES |
Size of sector in bytes.
Definition at line 34 of file Flash.hh.
const uint32_t Flash::Device::SECTOR_MASK |
Sector address mask.
Definition at line 40 of file Flash.hh.
const uint16_t Flash::Device::SECTOR_MAX |
Number of sectors.
Definition at line 43 of file Flash.hh.
The documentation for this class was generated from the following file: