1#ifndef Driver_NV_File_Cpl_Api_h_
2#define Driver_NV_File_Cpl_Api_h_
16#include "colony_config.h"
21#ifndef OPTION_DRIVER_NV_FILE_CPL_NUM_PAGES
22#define OPTION_DRIVER_NV_FILE_CPL_NUM_PAGES 512
26#ifndef OPTION_DRIVER_NV_FILE_CPL_BYTES_PER_PAGE
27#define OPTION_DRIVER_NV_FILE_CPL_BYTES_PER_PAGE 128
32#ifndef OPTION_DRIVER_NV_FILE_CPL_FILE_NAME
33#define OPTION_DRIVER_NV_FILE_CPL_FILE_NAME "eeprom.bin"
38#ifndef OPTION_DRIVER_NV_FILE_CPL_ERASED_VALUE
39#define OPTION_DRIVER_NV_FILE_CPL_ERASED_VALUE 0xFF
74 bool write(
size_t dstOffset, const
void* srcData,
size_t numBytesToWrite ) noexcept;
77 bool read(
size_t srcOffset,
void* dstData,
size_t numBytesToRead ) noexcept;
#define OPTION_DRIVER_NV_FILE_CPL_NUM_PAGES
Number of Pages.
Definition Api.h:22
#define OPTION_DRIVER_NV_FILE_CPL_FILE_NAME
The filename to use as the physical storage.
Definition Api.h:33
#define OPTION_DRIVER_NV_FILE_CPL_BYTES_PER_PAGE
Number of bytes per page.
Definition Api.h:27
This class defines the interface for a platform independent Non-volatile storage driver.
Definition Api.h:35
This class implements the Non-volatile storage driver using the Cpl::Io::File interfaces.
Definition Api.h:59
bool start() noexcept
See Driver::NV::Api.
bool read(size_t srcOffset, void *dstData, size_t numBytesToRead) noexcept
See Driver::NV::Api.
size_t getNumPages() const noexcept
See Driver::NV::Api.
bool m_started
Started state.
Definition Api.h:100
size_t m_numPages
number of pages
Definition Api.h:91
void stop() noexcept
See Driver::NV::Api.
size_t m_pageSize
bytes per page
Definition Api.h:94
Api(size_t numPages=OPTION_DRIVER_NV_FILE_CPL_NUM_PAGES, size_t bytesPerPage=OPTION_DRIVER_NV_FILE_CPL_BYTES_PER_PAGE, const char *filename=OPTION_DRIVER_NV_FILE_CPL_FILE_NAME)
Constructor.
size_t getPageSize() const noexcept
See Driver::NV::Api.
size_t m_totalSize
Actual storage size.
Definition Api.h:97
bool write(size_t dstOffset, const void *srcData, size_t numBytesToWrite) noexcept
See Driver::NV::Api.
const char * m_fname
File name.
Definition Api.h:88
The 'Cpl' namespace is the root name space for the Colony.
Definition Api16.h:20