Nut/OS  4.10.3
API Reference
XgUFlash

Data Structures

struct  _BLOCK_USAGE
 Internal block usage cache structure. More...
struct  _BLOCKHEAD
 UFLASH block header. More...
struct  _BLOCKFOOT
 UFLASH block footer. More...
struct  _ENTRYHEAD
struct  _UFLASHENTRY
 File system entry descriptor. More...
struct  _UFLASHVOLUME
 Volume info structure. More...
struct  _UFLASHFIND
 Entry search structure. More...

Defines

#define UFLASH_MAX_BLOCKS   8192
 Max. number of blocks per file system.
#define UFLASH_BLOCK_UNITS   4
 Number of units per block.
#define UFLASH_ENTRIES   128
 Number of file system entries.
#define UFLASH_USAGE_CACHE   32
 Size of the least used buffer.
#define UFLASH_MAX_PATH   0
 Maximum lenght of a full absolute path.
#define UFLASH_BLOCK_INVALID   ((blknum_t)-1)
#define UFLASH_VOLF_FIXED   0x80

Typedefs

typedef uint16_t blknum_t
typedef uint_fast16_t blknum_fast_t
typedef struct _BLOCK_USAGE BLOCK_USAGE
 Internal block usage cache structure.
typedef struct _BLOCKHEAD BLOCKHEAD
 UFLASH block header.
typedef struct _BLOCKFOOT BLOCKFOOT
 UFLASH block footer.
typedef struct _ENTRYHEAD ENTRYHEAD
typedef struct _UFLASHENTRY UFLASHENTRY
 File system entry descriptor.
typedef struct _UFLASHVOLUME UFLASHVOLUME
 Volume info structure type.
typedef struct _UFLASHFIND UFLASHFIND
 Entry search structure.

Functions

int UFlashAttach (NUTDEVICE *dev, NUTSERIALFLASH *sfi, NUTSPIBUS *bus)
 Attach an UFLASH file system to a serial flash device.
void UFlashDetach (NUTDEVICE *dev)
 Detach an UFLASH file system from a serial flash device.
int UFlashFormat (NUTDEVICE *dev, NUTSERIALFLASH *sfi, NUTSPIBUS *bus)
 Format an UFLASH volume.

Variables

NUTDEVICE devUFlash0
 UFLASH0 file system device.
NUTDEVICE devUFlash1
 UFLASH1 file system device.

Define Documentation

#define UFLASH_MAX_BLOCKS   8192

Max. number of blocks per file system.

Definition at line 101 of file uflashfs.c.

Referenced by UFlashFormat().

#define UFLASH_BLOCK_UNITS   4

Number of units per block.

Definition at line 106 of file uflashfs.c.

Referenced by UFlashFormat().

#define UFLASH_ENTRIES   128

Number of file system entries.

Definition at line 111 of file uflashfs.c.

#define UFLASH_USAGE_CACHE   32

Size of the least used buffer.

Definition at line 116 of file uflashfs.c.

#define UFLASH_MAX_PATH   0

Maximum lenght of a full absolute path.

If not defined, a variable path name length is used. Note, that the total size of the name is still limited, because the block header and the entry header must fit into the first unit of the file system block.

Definition at line 138 of file uflashfs.c.

#define UFLASH_BLOCK_INVALID   ((blknum_t)-1)

Definition at line 141 of file uflashfs.c.

#define UFLASH_VOLF_FIXED   0x80

Definition at line 225 of file uflashfs.c.


Typedef Documentation

typedef uint16_t blknum_t

Definition at line 123 of file uflashfs.c.

Definition at line 124 of file uflashfs.c.

typedef struct _BLOCK_USAGE BLOCK_USAGE

Internal block usage cache structure.

typedef struct _BLOCKHEAD BLOCKHEAD

UFLASH block header.

Each used block starts with a BLOCKHEAD structure.

typedef struct _BLOCKFOOT BLOCKFOOT

UFLASH block footer.

Each block ends with a BLOCKFOOT structure.

typedef struct _ENTRYHEAD ENTRYHEAD
typedef struct _UFLASHENTRY UFLASHENTRY

File system entry descriptor.

typedef struct _UFLASHVOLUME UFLASHVOLUME

Volume info structure type.

Definition at line 228 of file uflashfs.c.

typedef struct _UFLASHFIND UFLASHFIND

Entry search structure.


Function Documentation

int UFlashAttach ( NUTDEVICE dev,
NUTSERIALFLASH sfi,
NUTSPIBUS bus 
)

Attach an UFLASH file system to a serial flash device.

This function will initialize the hardware and mount the volume.

Parameters:
devSpecifies the file system device.
sfiSpecifies the serial flash interface.
busSpecifies the SPI bus driver.
Returns:
0 on success, -1 on errors.

Definition at line 1842 of file uflashfs.c.

References _NUTSPIBUS::bus_initnode, _NUTSPIBUS::bus_mutex, _NUTDEVICE::dev_icb, _NUTSPINODE::node_bus, NUTASSERT, NutEventPost(), _NUTSERIALFLASH::sf_init, and _NUTSERIALFLASH::sf_node.

Here is the call graph for this function:

void UFlashDetach ( NUTDEVICE dev)

Detach an UFLASH file system from a serial flash device.

This function will unmount the volume and release all occupied resources.

Parameters:
devSpecifies the file system device.
Returns:
0 on success, -1 on errors.

Definition at line 1877 of file uflashfs.c.

References _NUTDEVICE::dev_icb, NUTASSERT, and _NUTSERIALFLASH::sf_exit.

int UFlashFormat ( NUTDEVICE dev,
NUTSERIALFLASH sfi,
NUTSPIBUS bus 
)

Format an UFLASH volume.

Formatting an UFLASH volume is easy: All blocks are simply erased. Therefore, formatting is required only to remove existing contents, which is incompatible with the current format options. The caller must make sure, that the volume is not mounted.

Parameters:
devSpecifies the file system device.
sfiSpecifies the serial flash interface.
busSpecifies the SPI bus driver.
Returns:
0 on success, -1 on errors.

Definition at line 1905 of file uflashfs.c.

References _NUTSPIBUS::bus_initnode, _NUTSPIBUS::bus_mutex, _NUTDEVICE::dev_dcb, _NUTSPINODE::node_bus, NUTASSERT, NutEventPost(), _NUTSERIALFLASH::sf_exit, _NUTSERIALFLASH::sf_init, _NUTSERIALFLASH::sf_node, _NUTSERIALFLASH::sf_rsvbot, _NUTSERIALFLASH::sf_rsvtop, _NUTSERIALFLASH::sf_units, UFLASH_BLOCK_UNITS, and UFLASH_MAX_BLOCKS.

Here is the call graph for this function:


Variable Documentation

Initial value:
 {
    0,                          
    {'U', 'F', 'L', 'A', 'S', 'H', '0', 0, 0}
    ,                           
    IFTYP_FS,                   
    0,                          
    0,                          
    NULL,                       
    NULL,                       
    UFlashInit,                 
    UFlashIOCtl,                
    UFlashFileRead,             
    UFlashFileWrite,            

    UFlashFileWrite_P,          

    UFlashFileOpen,             
    UFlashFileClose,            
    UFlashFileSize              
}

UFLASH0 file system device.

Definition at line 2039 of file uflashfs.c.

Initial value:
 {
    0,                          
    {'U', 'F', 'L', 'A', 'S', 'H', '1', 0, 0}
    ,                           
    IFTYP_FS,                   
    1,                          
    0,                          
    NULL,                       
    NULL,                       
    UFlashInit,                 
    UFlashIOCtl,                
    UFlashFileRead,             
    UFlashFileWrite,            

    UFlashFileWrite_P,          

    UFlashFileOpen,             
    UFlashFileClose,            
    UFlashFileSize              
}

UFLASH1 file system device.

Definition at line 2063 of file uflashfs.c.