ATMEL: Overview

- Main Page
- Modules
- Data Structures
- Files
- Related Pages

# Overview
[File System]

### Introduction

The ATMEL File System is a module optimized for the C51/AVR8/AVR32 chip from ATMEL.
The footprint is very small, many features are included, and specific caches are implemented to optimize the speed.
The particularities of ATMEL File System are the Navigator Identifier, the "file list" and the File index :

### Navigator ID

One navigator ID allows to explore a disk or open a file.
If you want to open 2 files at the same time then you must use 2 navigators ID.
If you want to explore 2 directories at the same time then you must use 2 navigators ID.
If you want to explore 1 directory and open 1 file at the same time then you must use 2 navigators ID.
Thus the advantages are :

- possibility to open many files at the same time
- possibility to explore many disks at the same time
  The switch between the navigations is very fast.
  The navigator is the same to open and to explore, but if you open a file then the navigation routines (next,...) are not autorized.
  The number of ID navigators is defined by FS_NB_NAVIGATOR.
  Each navigator uses only 40B of RAM space.
  A good example to understand the advantage of navigation ID is copy a disk to another disk .

### File List

Two information allow the navigation, the "current folder" and the "file selected".
The "File list" is the list of all folders and all files present in "current folder" like a Windows explorer (the sub folder and sub file aren't included).
The "file selected" is a cursor on the "File list" (The unselect position exists).
When the nav_dir_cd() and nav_dir_gotoparent() routines are called, the "current folder" and "File list" change.
After a nav_partition_mount() :

- the "current folder" is the Root directory
- "File list" contains all folders and all files included in Root directory
- "file selected" is at position "unselect"
  About order in the "File list" :
- directories are stored before the file
- the order of directories or files is the creation order

Example:

    // A disk architecture
    folder1
    |  folder3
    |  |  file4
    |  file5
    file1
    file2
    folder2
    |  file6
    file3

    // The "File list" provides by the navigator when the "root" is the "current folder"
    folder1
    folder2
    file1
    file2
    file3

    // The "File list" provides by the navigator when the "folder1" is the "current folder" (via nav_dir_cd())
    folder3
    file5

### File Index

A File Index is a small pointer structure which contains a file position.
This structure allows to store a file list in a small memory space, and allows a fast access to the file.
The following routines are used to manage file index : nav_getindex(), nav_gotoindex().

### Error control

Many routines return a status TRUE or FALSE.
In case of FALSE status, the fs_g_status contains the error identifier to retrieve more information about the error.
The error list is available here.