Nut/OS  4.10.3
API Reference
uflashfs.c File Reference

UFLASH File System. More...

#include <fs/fs.h>
#include <sys/nutdebug.h>
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <string.h>
#include <errno.h>
#include <dirent.h>
#include <dev/spi_at45dib.h>
#include <fs/uflashfs.h>
Include dependency graph for uflashfs.c:

Go to the source code of this file.

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.

Detailed Description

UFLASH File System.

The UFLASH file system has been specifically designed for serial flash memory chips used on tiny embedded systems.

Such memory chips do not allow to program single bytes. Instead, only full pages can be programmed. On the other hand, these chips provide one or two integrated RAM buffers. They allow to modify single bytes without transfering full pages between the memory chip and the microcontroller's RAM.

Although no mechanism has been implemented to replace worn out pages, the file system maintains a very well balanced wear levelling. This includes regular movement of static files.

Furthermore, previously unfinished write accesses are automatically detected and reverted when mounting a volume. However, this features still needs to be tested more thoroughly.

Note, that directories do not really exist in the UFLASH file system. They are mimicked in a limited way. When scanning a directory, all subdirectories will appear again for each file they contain.

 * $Id$
 * 

Definition in file uflashfs.c.