|
COSA
An Object-Oriented Platform for Arduino Programming
|
#include <CFFS.hh>

Classes | |
| struct | descr_t |
| class | File |
Static Public Member Functions | |
| static bool | begin (Flash::Device *flash) |
| static int | ls (IOStream &outs) |
| static int | rm (const char *filename) |
| static int | cd (const char *filename) |
| static int | mkdir (const char *filename) |
| static int | rmdir (const char *filename) |
| static int | format (Flash::Device *flash, const char *name) |
Static Public Attributes | |
| static const size_t | FILENAME_MAX = 22 |
Protected Types | |
| enum | { CFFS_TYPE = 0xf5cf, FILE_ENTRY_TYPE = 0x8001, FILE_BLOCK_TYPE = 0x8002, DIR_ENTRY_TYPE = 0x8003, DIR_BLOCK_TYPE = 0x8004, FREE_TYPE = 0xffff, ALLOC_MASK = 0x8000, TYPE_MASK = 0x7fff } |
Static Protected Member Functions | |
| static int | read (void *dest, uint32_t src, size_t size) |
| static int | write (uint32_t dest, const void *src, size_t size) |
| static int | write_P (uint32_t dest, const void *src, size_t size) |
| static int | lookup (const char *filename, descr_t &entry, uint32_t &addr) |
| static int | create (const char *filename, uint16_t type, uint8_t flags, descr_t &entry, uint32_t &addr) |
| static int | remove (uint32_t addr, uint16_t type) |
| static uint32_t | next_free_sector () |
| static uint32_t | next_free_directory () |
| static int | find_end_of_file (uint32_t sector, uint32_t &pos, uint32_t &size) |
Static Protected Attributes | |
| static const uint32_t | NULL_REF = 0xffffffffL |
| static const size_t | DIR_MAX = 16 |
| static Flash::Device * | device = NULL |
| static uint32_t | current_dir_addr = 0L |
Friends | |
| class | File |
Cosa Flash File System for Flash Memory.
Directory entries are not reclaimed (directory block is not erased and rewritten when full).
|
protected |
CFFS object types:
CFFS_TYPE is the file system master block on the device. It is the first object on the flash; size is the size of the header, ref is the address of the root directory (the next object), and the name of the device.
FILE_ENTRY_TYPE is a file descriptor; size is not used, ref is the address of the first file block, name is the name of the file.
FILE_BLOCK_TYPE is a file block; size is the block size (typically sector size), ref is the address of the next block, name is not used (filled with zero).
DIR_ENTRY_TYPE is a directory reference; size is not used, ref is the address of the directory block, name is the name of the directory.
DIR_BLOCK_TYPE is directory block header; size is the directory sector, ref is the address to the next directory block (NULL is encoded as 0xffffffffL, NULL_REF)
| Enumerator | |
|---|---|
| CFFS_TYPE |
File System Master header. |
| FILE_ENTRY_TYPE |
File descriptor entry. |
| FILE_BLOCK_TYPE |
File data block. |
| DIR_ENTRY_TYPE |
Directory reference entry. |
| DIR_BLOCK_TYPE |
Directory block. |
| FREE_TYPE |
Free descriptor. |
| ALLOC_MASK |
Allocated mask. |
| TYPE_MASK |
Type mask. |
|
static |
|
static |
|
staticprotected |
Create directory entry with given file name and type. The flags (O_EXCL) may be used to fail if the file already exists. The type must be DIR_TYPE or FILE_TYPE. Returns zero and entry otherwise negative error code.
| [in] | filename | to create. |
| [in] | type | of entry to create. |
| [in] | flags | open flags to check. |
| [out] | entry | setting. |
| [out] | addr | address of entry. |
|
staticprotected |
|
static |
|
staticprotected |
|
static |
|
static |
|
staticprotected |
|
staticprotected |
|
staticprotected |
Read flash block with the given size into the buffer from the source address. Return number of bytes read or negative error code.
| [in] | dest | buffer to read from flash into. |
| [in] | src | address in flash to read from. |
| [in] | size | number of bytes to read. |
|
staticprotected |
|
static |
|
static |
|
staticprotected |
Write flash block at given destination address with the contents of the source buffer. Return number of bytes written or negative error code.
| [in] | dest | address in flash to write to. |
| [in] | src | buffer to write to flash. |
| [in] | size | number of bytes to write. |
|
staticprotected |
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.
| [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. |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
static |
|
staticprotected |