Volatile RAM file system. More...
Data Structures | |
struct | PNUT_NODE |
Node structure. More... | |
struct | PNUT_DIRENTRY |
Directory entry structure. More... | |
struct | PNUT_FINDRESULT |
Directory search result information structure. More... | |
struct | _PNUTFILE |
PNUT file descriptor structure. More... | |
Defines | |
#define | SEEK_SET 0 |
#define | SEEK_CUR 1 |
#define | SEEK_END 2 |
#define | NODETYPE_REG 0 |
#define | NODETYPE_DIR 1 |
#define | PNUT_MAX_NAMELEN (PNUT_DIRENT_SIZE - sizeof(PNUT_BLKNUM) - sizeof(uint8_t) - 1) |
Maximum length of a base name. | |
#define | PNUT_MAX_FILESIZE (PNUT_BLOCKS_PER_NODE * PNUT_BLOCK_SIZE) |
Maximum size of a file or directory. | |
#define | PNUT_TOTAL_BLOCKS (PNUTBANK_COUNT * (NUTBANK_SIZE / PNUT_BLOCK_SIZE)) |
Size of each memory bank. | |
#define | BLOCKS_PER_BANK (NUTBANK_SIZE / PNUT_BLOCK_SIZE) |
#define | NUTBANK_PTR ((char *)NUTBANK_START) |
Typedefs | |
typedef short | PNUT_BLKNUM |
typedef struct _PNUTFILE | PNUTFILE |
PNUT file descriptor type. | |
Functions | |
void | BankSelect (PNUT_BLKNUM blk) |
Make the bank visible, which contains the specified block. | |
PNUT_NODE * | BankNodePointer (PNUT_BLKNUM blk) |
Select specified bank and return pointer to block. | |
int | PnutIOCtl (NUTDEVICE *dev, int req, void *conf) |
Device specific functions. | |
Variables | |
NUTDEVICE | devPnut |
Peanut device information structure. | |
Peanut File System Configuration | |
The Nut/OS Configurator may be used to override the default values. | |
#define | PNUT_BLOCK_SIZE 512 |
Size of a filesystem block. | |
#define | PNUT_DIRENT_SIZE 32 |
Size of a directory entry. | |
#define | PNUT_BLOCKS_PER_NODE 250 |
Maximum number of blocks per node. | |
#define | PNUTBANK_COUNT 30 |
Volatile RAM file system.
#define PNUT_BLOCK_SIZE 512 |
Size of a filesystem block.
Referenced by BankNodePointer().
#define PNUT_DIRENT_SIZE 32 |
Size of a directory entry.
#define PNUT_BLOCKS_PER_NODE 250 |
Maximum number of blocks per node.
Peanut supports only one node per file. Thus, this number multiplied by PNUT_BLOCK_SIZE specifies the maximum file size.
Changings this number will change the size of the node structure, which must fit into a single filesystem block.
#define PNUTBANK_COUNT 30 |
#define SEEK_SET 0 |
#define SEEK_CUR 1 |
#define SEEK_END 2 |
#define NODETYPE_REG 0 |
#define NODETYPE_DIR 1 |
#define PNUT_MAX_NAMELEN (PNUT_DIRENT_SIZE - sizeof(PNUT_BLKNUM) - sizeof(uint8_t) - 1) |
Maximum length of a base name.
This is a calculated value and depends on the definition of the block size and the size of a directory entry.
#define PNUT_MAX_FILESIZE (PNUT_BLOCKS_PER_NODE * PNUT_BLOCK_SIZE) |
Maximum size of a file or directory.
This is a calculated value and depends on the definition of the block size and the number of blocks per directory entry.
#define PNUT_TOTAL_BLOCKS (PNUTBANK_COUNT * (NUTBANK_SIZE / PNUT_BLOCK_SIZE)) |
Size of each memory bank.
Total number of blocks on this device.
This value is calulated by multiplying the number of memory banks reserved for the file system by the number of blocks per bank.
For example, if all 30 banks, which are available on Ethernut 2, are reserved for PNUT and if the size of a block is 512 bytes, then 960 blocks are available.
#define BLOCKS_PER_BANK (NUTBANK_SIZE / PNUT_BLOCK_SIZE) |
Referenced by BankNodePointer(), and BankSelect().
#define NUTBANK_PTR ((char *)NUTBANK_START) |
Referenced by BankNodePointer().
typedef short PNUT_BLKNUM |
void BankSelect | ( | PNUT_BLKNUM | blk | ) |
Make the bank visible, which contains the specified block.
On Ethernut 2 we select a bank by writing the bank number to the bank register base address plus the bank number.
For example, writing 0x12 to 0xFF12 selects bank 18 (0x12), assuming that 0xFF00 is the bank register base address.
blk | Block number to access. |
References BLOCKS_PER_BANK, and NutSegBufEnable.
Referenced by BankNodePointer().
PNUT_NODE* BankNodePointer | ( | PNUT_BLKNUM | blk | ) |
Select specified bank and return pointer to block.
References BankSelect(), BLOCKS_PER_BANK, NULL, NUTBANK_PTR, and PNUT_BLOCK_SIZE.
int PnutIOCtl | ( | NUTDEVICE * | dev, |
int | req, | ||
void * | conf | ||
) |
Device specific functions.
References FS_DIR_CLOSE, FS_DIR_CREATE, FS_DIR_OPEN, FS_DIR_READ, FS_DIR_REMOVE, FS_FILE_DELETE, FS_FILE_SEEK, FS_FILE_STATUS, FS_STATUS, _FSCP_STATUS::par_path, _FSCP_STATUS::par_stp, and rc.