Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
TiSPIFFS< ERASE_PAGE_SIZE > Class Template Reference

Specialization of Serial SPIFFS driver for TI driverlib devices. More...

#include <TiSPIFFS.hxx>

Inheritance diagram for TiSPIFFS< ERASE_PAGE_SIZE >:
SPIFFS FileSystem Atomic FileIO

Public Member Functions

 TiSPIFFS (size_t physical_address, size_t size_on_disk, size_t logical_block_size, size_t logical_page_size, size_t max_num_open_descriptors=16, size_t cache_pages=8, std::function< void()> post_format_hook=nullptr)
 Constructor.
 
 ~TiSPIFFS ()
 Destructor.
 
- Public Member Functions inherited from SPIFFS
void mount (const char *mount_point) override
 Mount the file system.
 
void format () override
 Format the file system, all data will be lost.
 
bool is_any_dirty ()
 
void flush_cache ()
 Performs a sync on all files that have had a write but no fsync call since then.
 
- Public Member Functions inherited from FileSystem
 FileSystem ()
 Constructor.
 
virtual ~FileSystem ()
 Destructor.
 

Private Member Functions

int32_t flash_read (uint32_t addr, uint32_t size, uint8_t *dst) override
 SPIFFS callback to read flash, in context.
 
int32_t flash_write (uint32_t addr, uint32_t size, uint8_t *src) override
 SPIFFS callback to write flash, in context.
 
int32_t flash_erase (uint32_t addr, uint32_t size) override
 SPIFFS callback to erase flash, in context.
 
 DISALLOW_COPY_AND_ASSIGN (TiSPIFFS)
 

Additional Inherited Members

- Static Public Member Functions inherited from SPIFFS
static void extern_lock (struct spiffs_t *fs)
 Provide mutex lock.
 
static void extern_unlock (struct spiffs_t *fs)
 Provide mutex unlock.
 
- Static Public Member Functions inherited from FileSystem
static int open (struct _reent *reent, const char *path, int flags, int mode)
 Open a file or device.
 
static int close (struct _reent *reent, int fd)
 Close a file or device.
 
static int unlink (struct _reent *reent, const char *path)
 Remove a file.
 
static int stat (struct _reent *reent, const char *path, struct stat *stat)
 Get the status information of a file or device.
 
static int fsync (int fd)
 Synchronize (flush) a file to disk.
 
static int closedir (DIR *dirp)
 Close a directory.
 
static DIRopendir (const char *name)
 Open a directory.
 
static struct direntreaddir (DIR *dirp)
 Read the next entry in a directory.
 
- Static Public Member Functions inherited from FileIO
static ssize_t read (struct _reent *reent, int fd, void *buf, size_t count)
 Read from a file or device.
 
static ssize_t write (struct _reent *reent, int fd, const void *buf, size_t count)
 Write to a file or device.
 
static _off_t lseek (struct _reent *reent, int fd, _off_t offset, int whence)
 Change the offset index of a file or device.
 
static int fstat (struct _reent *reent, int fd, struct stat *stat)
 Get the status information of a file or device.
 
static int ioctl (int fd, unsigned long int key, unsigned long data)
 Request and ioctl transaction.
 
static int fcntl (int fd, int cmd, unsigned long data)
 Manipulate a file descriptor.
 
static bool is_device (int fd)
 Test if the file descriptor belongs to a device.
 
- Protected Member Functions inherited from SPIFFS
 SPIFFS (size_t physical_address, size_t size_on_disk, size_t erase_block_size, size_t logical_block_size, size_t logical_page_size, size_t max_num_open_descriptors=16, size_t cache_pages=8, std::function< void()> post_format_hook=nullptr)
 Constructor.
 
 ~SPIFFS ()
 Destructor.
 
void unmount ()
 Flushes caches and unmounts the filesystem.
 
- Protected Member Functions inherited from FileIO
 FileIO (const char *name)
 Constructor.
 
virtual ~FileIO ()
 Destructor.
 
virtual int ioctl (File *file, unsigned long int key, unsigned long data)
 Request an ioctl transaction.
 
virtual int fcntl (File *file, int cmd, unsigned long data)
 Manipulate a file descriptor.
 
virtual bool select (File *file, int mode)
 Device select method.
 
- Static Protected Member Functions inherited from SPIFFS
static int flash_read (struct spiffs_t *fs, unsigned addr, unsigned size, uint8_t *dst)
 SPIFFS callback to read flash.
 
static int flash_write (struct spiffs_t *fs, unsigned addr, unsigned size, uint8_t *src)
 SPIFFS callback to write flash.
 
static int flash_erase (struct spiffs_t *fs, unsigned addr, unsigned size)
 SPIFFS callback to erase flash.
 
- Static Protected Member Functions inherited from FileIO
static int fd_alloc (void)
 Allocate a free file descriptor.
 
static void fd_free (int fd)
 Free up a file descriptor.
 
static Filefile_lookup (int fd)
 Looks up a reference to a File corresponding to a given file descriptor.
 
static int fd_lookup (File *file)
 Looks up a file descriptor corresponding to a given File reference.
 
- Protected Attributes inherited from SPIFFS
spiffs * fs_
 file system instance metadata
 
- Protected Attributes inherited from FileIO
const char * name
 device name
 
- Static Protected Attributes inherited from FileIO
static const unsigned int numOpenFiles = 20
 
static File files []
 File descriptor pool.
 
static OSMutex mutex
 mutual exclusion for fileio
 

Detailed Description

template<unsigned ERASE_PAGE_SIZE>
class TiSPIFFS< ERASE_PAGE_SIZE >

Specialization of Serial SPIFFS driver for TI driverlib devices.

Parameters
ERASE_PAGE_SIZEsize of an erase page in FLASH

Definition at line 44 of file TiSPIFFS.hxx.

Constructor & Destructor Documentation

◆ TiSPIFFS()

template<unsigned ERASE_PAGE_SIZE>
TiSPIFFS< ERASE_PAGE_SIZE >::TiSPIFFS ( size_t  physical_address,
size_t  size_on_disk,
size_t  logical_block_size,
size_t  logical_page_size,
size_t  max_num_open_descriptors = 16,
size_t  cache_pages = 8,
std::function< void()>  post_format_hook = nullptr 
)
inline

Constructor.

Definition at line 48 of file TiSPIFFS.hxx.

◆ ~TiSPIFFS()

template<unsigned ERASE_PAGE_SIZE>
TiSPIFFS< ERASE_PAGE_SIZE >::~TiSPIFFS ( )
inline

Destructor.

Definition at line 59 of file TiSPIFFS.hxx.

Member Function Documentation

◆ flash_erase()

template<unsigned ERASE_PAGE_SIZE>
int32_t TiSPIFFS< ERASE_PAGE_SIZE >::flash_erase ( uint32_t  addr,
uint32_t  size 
)
overrideprivatevirtual

SPIFFS callback to erase flash, in context.

Parameters
addradddress location to erase
sizesize of erase region in bytes

Implements SPIFFS.

Definition at line 74 of file TiSPIFFSImpl.hxx.

◆ flash_read()

template<unsigned ERASE_PAGE_SIZE>
int32_t TiSPIFFS< ERASE_PAGE_SIZE >::flash_read ( uint32_t  addr,
uint32_t  size,
uint8_t *  dst 
)
overrideprivatevirtual

SPIFFS callback to read flash, in context.

Parameters
addradddress location to read
sizesize of read in bytes
dstdestination buffer for read

Implements SPIFFS.

Definition at line 48 of file TiSPIFFSImpl.hxx.

◆ flash_write()

template<unsigned ERASE_PAGE_SIZE>
int32_t TiSPIFFS< ERASE_PAGE_SIZE >::flash_write ( uint32_t  addr,
uint32_t  size,
uint8_t *  src 
)
overrideprivatevirtual

SPIFFS callback to write flash, in context.

Parameters
addradddress location to write
sizesize of write in bytes
srcsource buffer for write

Implements SPIFFS.

Definition at line 62 of file TiSPIFFSImpl.hxx.


The documentation for this class was generated from the following files: