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

# navigation.h File Reference

FAT 12/16/32 Services. More...

`#include "fs_com.h"`
`#include "fat.h"`

Include dependency graph for navigation.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Defines
nav_filelist_set() options parameter
#define | FS_FIND_NEXT TRUE
| move in list to next file
#define | FS_FIND_PREV FALSE
| move in list to previous file
## Functions
void | nav_string_unicode (void)
| This function selects the UNICODE mode for all routines with FS_STRING parameter.
void | nav_string_ascii (void)
| This function selects the ASCII mode for all routines with FS_STRING parameter.
void | nav_string_length_enable (void)
| This function selects the LENGTH string mode for all routines with FS_STRING parameter.
void | nav_string_length_disable (void)
| This function deselects the LENGTH string mode for all routines with FS_STRING parameter.
void | nav_checkdisk_disable (void)
| This function disables the disk check before each actions on disk.
void | nav_checkdisk_enable (void)
| This function enables the disk check before each actions on disk.
void | nav_reset (void)
| This function resets ALL navigations to init file system core.
void | nav_exit (void)
| This function flush ALL navigations before exit of file system core.
Bool | nav_select (U8 u8_idnav)
| This function selects the navigation to use.
U8 | nav_get (void)
| This function returns the navigation identifier used.
Bool | nav_copy (U8 u8_idnav)
| This function copys the navigator information to another navigator.
U8 | nav_drive_nb (void)
| This function returns the number of devices availabled.
Bool | nav_drive_set (U8 u8_number)
| This function selects a drive in navigator but don't mount the disk partition.
U8 | nav_drive_get (void)
| This function returns the selected drive number.
U8 | nav_drive_getname (void)
| This function returns the selected drive letter.
Bool | nav_drive_format (U8 u8_fat_type)
| This function formats the current drive (=disk).
U8 | nav_partition_nb (void)
| This function returns the number of partitions present on drive.
Bool | nav_partition_set (U8 partition_number)
| This function selects a partition on drive.
Bool | nav_partition_mount (void)
| This function mounts the selected partition.
U8 | nav_partition_type (void)
| This function gives the partition type.
Bool | nav_partition_serialnumber (Bool b_action, U8 _MEM_TYPE_SLOW_ *a_u8_sn)
| This function reads or writes the serial number on the selected partition.
Bool | nav_partition_label (Bool b_action, FS_STRING sz_label)
| This function reads or writes the label of selected partition.
U32 | nav_partition_space (void)
| This function returns partition total space.
U8 | nav_partition_cluster_size (void)
| This function returns the partition cluster size.
U32 | nav_partition_freespace (void)
| This function returns the partition free space.
U8 | nav_partition_freespace_percent (void)
| This function returns the partition space free in percent.
Bool | nav_filelist_single_enable (Bool b_type)
| To display in File List only the files OR directories.
Bool | nav_filelist_single_disable (void)
| To display in File List the directories AND files.
Bool | nav_filelist_reset (void)
| This function resets the selection pointer, so "no file selected" in file list.
Bool | nav_filelist_validpos (void)
| This function checks if a file is selected.
Bool | nav_filelist_fileisnotopen (void)
| This function checks if no file is open.
Bool | nav_filelist_set (U16 u16_nb, Bool b_direction)
| This function moves the selection pointer in file list.
U16 | nav_filelist_get (void)
| This function returns the position of selected file in file list.
Bool | nav_filelist_goto (U16 u16_newpos)
| This function goes at a position in file list.
Bool | nav_filelist_findname (const FS_STRING sz_name, Bool b_match_case)
| This function searchs a file name in file list.
Bool | nav_filelist_eol (void)
| This function checks the end of file list.
Bool | nav_filelist_bol (void)
| This function checks the beginning of file list.
Bool | nav_filelist_exist (Bool b_type)
| This function checks the presence of files or directories in file list.
U16 | nav_filelist_nb (Bool b_type)
| This function computes the number of files or directories in file list.
Bool | nav_filelist_first (Bool b_type)
| This function goes to at the first file or directory in file list.
Bool | nav_filelist_last (Bool b_type)
| This function goes to at the last file or directory in file list.
Fs_index | nav_getindex (void)
| This function returns a small index on the selected file.
Bool | nav_gotoindex (const Fs_index _MEM_TYPE_SLOW_ *index)
| This function selects a file in the navigator via a file index.
Bool | nav_dir_root (void)
| This function initializes the file list on the root directory.
Bool | nav_dir_is_root (void)
| This function check the current directory.
Bool | nav_dir_cd (void)
| This function enters in the selected directory in file list.
Bool | nav_dir_gotoparent (void)
| This function goes to the parent directory.
Bool | nav_dir_name (FS_STRING sz_path, U8 u8_size_max)
| This function returns the directory name corresponding at the file list.
Bool | nav_dir_make (const FS_STRING sz_name)
| This function creates a directory in the directory corresponding at file list.
Bool | nav_getcwd (FS_STRING sz_path, U8 u8_size_path, Bool b_view_file_select)
| This function returns the full path of the selection.
Bool | nav_setcwd (FS_STRING sz_path, Bool b_match_case, Bool b_create)
| This function selects a disk position via a path.
Bool | nav_file_getname (FS_STRING sz_name, U8 u8_size_max)
| This function returns the name of selected file.
Bool | nav_file_name (FS_STRING sz_name, U8 u8_size_max, Bool b_mode, Bool b_match_case)
| This function returns the name of selected file or checks the string with the name of selected file.
U32 | nav_file_lgt (void)
| This function returns the size of selected file (unit byte).
U16 | nav_file_lgtsector (void)
| This function returns the size of selected file (unit sector).
Bool | nav_file_isreadonly (void)
| This function checks the write protection of disk and the attribut "read only" of selected file.
Bool | nav_file_isdir (void)
| This function returns the type of selected file.
Bool | nav_file_checkext (const FS_STRING sz_filterext)
| This function checks the extension of selected file.
Bool | nav_file_dateget (FS_STRING sz_date, Bool type_date)
| This function returns the date of selected file.
U8 | nav_file_attributget (void)
| This function returns the attribut of selected file.
Bool | nav_file_dateset (const FS_STRING sz_date, Bool type_date)
| This function changes the date of selected file.
Bool | nav_file_attributset (U8 u8_attribut)
| This function changes the attribut of selected file.
Bool | nav_file_del (Bool b_only_empty)
| This function deletes the selected file or directory.
Bool | nav_file_rename (const FS_STRING sz_name)
| This function renames the selected directory or file.
Bool | nav_file_create (const FS_STRING sz_name)
| This function creates a file with NULL size and NULL attribut.
Bool | nav_file_copy (void)
| This function updates the COPY navigator with the selected file.
Bool | nav_file_paste_start (const FS_STRING sz_name)
| This function pastes the selected file in COPY navigator in the file list of the current navigator.
U8 | nav_file_paste_state (Bool b_stop)
| This function executes the copy file.

## Detailed Description

FAT 12/16/32 Services.

This file defines a useful set of functions for file navigation.

Author:
  Atmel Corporation: http://www.atmel.com
  Support and FAQ: http://support.atmel.no/

Definition in file navigation.h.

## Define Documentation

#define FS_FIND_NEXT TRUE

move in list to next file

Definition at line 48 of file navigation.h.

Referenced by copy_dir(), nav_dir_gotoparent(), nav_filelist_bol(), nav_filelist_eol(), nav_filelist_exist(), nav_filelist_findname(), nav_filelist_first(), nav_filelist_goto(), nav_filelist_last(), nav_filelist_nb(), nav_filelist_set(), nav_gotoindex(), ushell_cmd_ls(), and ushell_cmd_sync().

#define FS_FIND_PREV FALSE

move in list to previous file

Definition at line 49 of file navigation.h.

Referenced by nav_filelist_bol(), nav_filelist_eol(), and nav_filelist_goto().

## Function Documentation

void nav_string_unicode | ( | void |  | ) |

This function selects the UNICODE mode for all routines with FS_STRING parameter.

    //! If you have enabled the FS_ASCII AND FS_UNICODE define
    //! then FS_STRING parameter can be a ASCII or UNICODE string.
    //!

Definition at line 84 of file navigation.c.

References g_b_unicode, and TRUE.

    00085 {
    00086    g_b_unicode = TRUE;
    00087 }

void nav_string_ascii | ( | void |  | ) |

This function selects the ASCII mode for all routines with FS_STRING parameter.

    //! If you have enabled the FS_ASCII AND FS_UNICODE define
    //! then FS_STRING parameter can be a ASCII or UNICODE string.
    //!

Definition at line 95 of file navigation.c.

References FALSE, and g_b_unicode.

    00096 {
    00097    g_b_unicode = FALSE;
    00098 }

void nav_string_length_enable | ( | void |  | ) |

This function selects the LENGTH string mode for all routines with FS_STRING parameter.

    //! In LENGTH string mode when you call a routine with FS_STRING parameter
    //! only the size (16bits, unit ASCII or UNICODE) is returned in the first 16bits of string array.
    //!

Definition at line 108 of file navigation.c.

References g_b_string_length, and TRUE.

    00109 {
    00110    g_b_string_length = TRUE;
    00111 }

void nav_string_length_disable | ( | void |  | ) |

This function deselects the LENGTH string mode for all routines with FS_STRING parameter.

    //! In LENGTH string mode when you call a routine with FS_STRING parameter
    //! only the size (16bits, unit ASCII or UNICODE) is returned in the first 16bits of string array.
    //!

Definition at line 119 of file navigation.c.

References FALSE, and g_b_string_length.

    00120 {
    00121    g_b_string_length = FALSE;
    00122 }

void nav_checkdisk_disable | ( | void |  | ) |

This function disables the disk check before each actions on disk.

    //! By default, between each read/write access a check disk (test unit ready) is sended at device.
    //! This check can reduce the speed access on specific disk.
    //!

Definition at line 134 of file navigation.c.

References g_b_no_check_disk, and TRUE.

    00135 {
    00136    g_b_no_check_disk = TRUE;
    00137 }

void nav_checkdisk_enable | ( | void |  | ) |

This function enables the disk check before each actions on disk.

    //! By default, between each read/write access a check disk (test unit ready) is sended at device.
    //! This check can reduce the speed access on specific disk.
    //!

Definition at line 146 of file navigation.c.

References FALSE, and g_b_no_check_disk.

    00147 {
    00148    g_b_no_check_disk = FALSE;
    00149 }

void nav_reset | ( | void |  | ) |

This function resets ALL navigations to init file system core.

    //! Call this at the program startup or before a new session (e.g. USB Device exit)
    //!

Definition at line 162 of file navigation.c.

References Fs_management::b_mode_nav_single, FALSE, fat_cache_clusterlist_reset(), fat_cache_reset(), Fat_file_close, fs_g_nav, fs_g_nav_fast, FS_NB_NAVIGATOR, FS_TYPE_FAT_UNM, g_b_no_check_disk, g_b_string_length, g_b_unicode, i, nav_select(), TRUE, Fs_management::u8_lun, Fs_management::u8_partition, and Fs_management_fast::u8_type_fat.

    00163 {
    00164 #if ( (FS_ASCII   == ENABLED) && (FS_UNICODE == ENABLED))
    00165    g_b_unicode = TRUE;
    00166 #endif
    00167    g_b_string_length = FALSE;
    00168    g_b_no_check_disk = FALSE;
    00169
    00170    fat_cache_reset();
    00171    fat_cache_clusterlist_reset();
    00172
    00173 #if (FS_NB_NAVIGATOR > 1)
    00174    {
    00175    U8 i;
    00176    // Reset variables of each navigators
    00177    for( i=0 ; i!=FS_NB_NAVIGATOR ; i++ )
    00178    {
    00179       nav_select(i);
    00180       fs_g_nav_fast.u8_type_fat = FS_TYPE_FAT_UNM; // By default the fat isn't mounted
    00181       fs_g_nav.u8_lun = 0xFF;                      // By default don't select a drive
    00182 #if (FS_MULTI_PARTITION  ==  ENABLED)
    00183       fs_g_nav.u8_partition=0;                     // By default select the first partition
    00184 #endif
    00185       Fat_file_close();                            // By default no file is opened
    00186       fs_g_nav.b_mode_nav_single = FALSE;          // By default display files and directories
    00187    }
    00188    // By default select the navigator 0
    00189    fs_g_u8_nav_selected = 0;
    00190    }
    00191 #else
    00192    fs_g_nav_fast.u8_type_fat = FS_TYPE_FAT_UNM;    // By default the fat isn't mounted
    00193    fs_g_nav.u8_lun = 0xFF;                         // By default don't select a drive
    00194 #  if (FS_MULTI_PARTITION  ==  ENABLED)
    00195    fs_g_nav.u8_partition=0;                        // By default select the first partition
    00196 #  endif
    00197    Fat_file_close();                               // By default no file is opened
    00198 #endif // (FS_NB_NAVIGATOR > 1)
    00199 }

Here is the call graph for this function:

void nav_exit | ( | void |  | ) |

This function flush ALL navigations before exit of file system core.

    //! Call this at the program exit or before a USB Device session
    //!

Definition at line 208 of file navigation.c.

References fat_cache_flush(), file_close(), FS_NB_NAVIGATOR, and nav_select().

    00209 {
    00210    // If you have opened files then close them
    00211 #if (FS_NB_NAVIGATOR > 1)
    00212    U8 u8_i;
    00213    for( u8_i=0; u8_i<FS_NB_NAVIGATOR; u8_i++)
    00214    {
    00215       nav_select(u8_i);
    00216       file_close();
    00217    }
    00218 #else
    00219    nav_select(0);
    00220    file_close();
    00221 #endif
    00222    // Flush data eventually present in FAT cache
    00223    fat_cache_flush();
    00224 }

Here is the call graph for this function:

Bool nav_select | ( | U8 | u8_idnav | ) |

This function selects the navigation to use.

Parameters:

  | u8_idnav | navigator identifier to select (0 to FS_NB_NAVIGATOR-1)

Returns:
  FALSE if ID navigator don't exist

  TRUE otherwise

Definition at line 234 of file navigation.c.

References FALSE, fat_invert_nav, FS_ERR_BAD_NAV, fs_g_status, FS_NB_NAVIGATOR, and TRUE.

    00235 {
    00236    if( FS_NB_NAVIGATOR <= u8_idnav )
    00237    {
    00238       fs_g_status = FS_ERR_BAD_NAV;             // The navigator doesn't exist
    00239       return FALSE;
    00240    }
    00241 #if (FS_NB_NAVIGATOR > 1)
    00242    if( fs_g_u8_nav_selected != u8_idnav )
    00243    {
    00244       fat_invert_nav( fs_g_u8_nav_selected );   // Deselect previous navigator = Select default navigator
    00245       fat_invert_nav( u8_idnav );               // Select new navigator
    00246       fs_g_u8_nav_selected = u8_idnav;
    00247    }
    00248 #endif
    00249    return TRUE;
    00250 }

U8 nav_get | ( | void |  | ) |

This function returns the navigation identifier used.

Returns:
  u8_idnav navigator identifier selected

Definition at line 257 of file navigation.c.

    00258 {
    00259 #if (FS_NB_NAVIGATOR > 1)
    00260    return fs_g_u8_nav_selected;
    00261 #else
    00262    return 0;
    00263 #endif
    00264 }

Bool nav_copy | ( | U8 | u8_idnav | ) |

This function copys the navigator information to another navigator.

Parameters:

  | u8_idnav | navigator identifier where the main navigator will be copied

Returns:
  FALSE in case of error, see global value "fs_g_status" for more detail

  TRUE otherwise

    //! Use this routine to select quickly the same file in another navigator
    //!

Definition at line 278 of file navigation.c.

References FALSE, fat_copy_nav, and TRUE.

    00279 {
    00280 #if (FS_NB_NAVIGATOR > 1)
    00281    if( fs_g_u8_nav_selected == u8_idnav )
    00282       return FALSE;                    // It is the source and destination is the same navigator
    00283    if( 0 == u8_idnav )
    00284       u8_idnav = fs_g_u8_nav_selected; // the default navigator is invert with the current navigator
    00285    if( 0 == u8_idnav)
    00286       return FALSE;                    // It is the source and destination is the same navigator
    00287    fat_copy_nav( u8_idnav );
    00288    return TRUE;
    00289 #else
    00290    u8_idnav++;
    00291    return FALSE;                       // Copy impossible because only one navigator is available
    00292 #endif
    00293 }

U8 nav_drive_nb | ( | void |  | ) |

This function returns the number of devices availabled.

Returns:
  number of devices, 0 = NO DEVICE AVAILABLED

    //! This value may be dynamic because it depends of memory drivers (e.g. Mass Storage disk on USB host mode)
    //!

Definition at line 308 of file navigation.c.

References get_nb_lun().

    00309 {
    00310    return get_nb_lun(); // Number of devices = Number of lun
    00311 }

Here is the call graph for this function:

Bool nav_drive_set | ( | U8 | u8_number | ) |

This function selects a drive in navigator but don't mount the disk partition.

Parameters:

  | u8_number | device number (0 to nav_drive_nb()-1 )

Returns:
  FALSE in case of error, see global value "fs_g_status" for more detail

  TRUE otherwise

Definition at line 321 of file navigation.c.

References FALSE, fat_check_noopen(), FS_ERR_END_OF_DRIVE, fs_g_nav, fs_g_nav_fast, fs_g_status, FS_TYPE_FAT_UNM, get_nb_lun(), TRUE, Fs_management::u8_lun, Fs_management::u8_partition, and Fs_management_fast::u8_type_fat.

    00322 {
    00323    if ( !fat_check_noopen() )
    00324       return FALSE;
    00325
    00326    if (u8_number >= get_nb_lun() )
    00327    {
    00328       fs_g_status = FS_ERR_END_OF_DRIVE;   // The drive number is bad
    00329       return FALSE;
    00330    }
    00331
    00332    if ( fs_g_nav.u8_lun == u8_number)
    00333       return TRUE;   // It is the same drive number
    00334
    00335    // Go to the device
    00336    fs_g_nav.u8_lun = u8_number;
    00337    fs_g_nav_fast.u8_type_fat = FS_TYPE_FAT_UNM;
    00338 #if (FS_MULTI_PARTITION  ==  ENABLED)
    00339    fs_g_nav.u8_partition=0;   // by default select the first partition
    00340 #endif
    00341    return TRUE;
    00342 }

Here is the call graph for this function:

U8 nav_drive_get | ( | void |  | ) |

This function returns the selected drive number.

Returns:
  0 to nav_drive_nb()-1

  0xFF in case of no drive selected

Definition at line 350 of file navigation.c.

References fs_g_nav, Fs_management::u8_lun, and Fs_management::u8_partition.

    00351 {
    00352 #if (FS_MULTI_PARTITION  ==  ENABLED)
    00353    if(0xFF == fs_g_nav.u8_lun)
    00354       return 0xFF;
    00355    return ((fs_g_nav.u8_lun*4) + fs_g_nav.u8_partition); // Maximum 4 partitions per device
    00356 #else
    00357    return (fs_g_nav.u8_lun);
    00358 #endif
    00359 }

U8 nav_drive_getname | ( | void |  | ) |

This function returns the selected drive letter.

Returns:
  'A','B',...

  'X', in case of no drive selected

Definition at line 367 of file navigation.c.

References fs_g_nav, Fs_management::u8_lun, and Fs_management::u8_partition.

    00368 {
    00369    if(0xFF == fs_g_nav.u8_lun)
    00370       return 'X';
    00371 #if (FS_MULTI_PARTITION  ==  ENABLED)
    00372    return ('A' + (fs_g_nav.u8_lun*4) + fs_g_nav.u8_partition); // Maximum 4 partitions per device
    00373 #else
    00374    return ('A' + fs_g_nav.u8_lun);
    00375 #endif
    00376 }

Bool nav_drive_format | ( | U8 | u8_fat_type | ) |

This function formats the current drive (=disk).

Parameters:

  | u8_fat_type | Select the format type FS_FORMAT_DEFAULT, The system chooses the better FAT format FS_FORMAT_FAT, The FAT12 or FAT16 is used to format the drive, if possible (disk space <2GB) FS_FORMAT_FAT32, The FAT32 is used to format the drive, if possible (disk space >32MB) FS_FORMAT_NOMBR_FLAG, if you don't want a MRB on the disk then add this flag (e.g. specific partition structure on a CD support)

Returns:
  FALSE in case of error, see global value "fs_g_status" for more detail

  TRUE otherwise

    //! WARNING: This routine can't format a multi-partiton, if the disk contains a multi-partition
    //! then this one is erased and replaced by a single partition on ALL disk space.
    //!

Referenced by ushell_cmd_format().

Here is the caller graph for this function:

U8 nav_partition_nb | ( | void |  | ) |

This function returns the number of partitions present on drive.

Returns:
  u8_number number of partitions

Definition at line 418 of file navigation.c.

References fat_get_nbpartition().

    00419 {
    00420    return fat_get_nbpartition();
    00421 }

Here is the call graph for this function:

Bool nav_partition_set | ( | U8 | partition_number | ) |

This function selects a partition on drive.

Parameters:

  | partition_number | partition number (0 to 3)

Returns:
  FALSE in case of error, see global value "fs_g_status" for more detail

  TRUE otherwise

Definition at line 431 of file navigation.c.

References FALSE, fat_check_noopen(), fs_g_nav, fs_g_nav_fast, FS_TYPE_FAT_UNM, TRUE, Fs_management::u8_partition, and Fs_management_fast::u8_type_fat.

    00432 {
    00433    if ( fs_g_nav.u8_partition == partition_number)
    00434       return TRUE;   // It is the same
    00435
    00436    if ( !fat_check_noopen() )
    00437       return FALSE;
    00438
    00439    // Go to partition
    00440    fs_g_nav.u8_partition = partition_number;
    00441    fs_g_nav_fast.u8_type_fat = FS_TYPE_FAT_UNM;
    00442    return TRUE;
    00443 }

Here is the call graph for this function:

Bool nav_partition_mount | ( | void |  | ) |

This function mounts the selected partition.

Returns:
  FALSE in case of error, see global value "fs_g_status" for more detail

  TRUE otherwise

    //! If the FS_MULTI_PARTITION option is disabled
    //! then the mount routine selects the first partition supported by file system. <br>
    //! After mount, the file list contains files and directories of ROOT directory
    //!

Returns:
  FALSE in case of error, see global value "fs_g_status" for more detail

  TRUE otherwise

    //! If the FS_MULTI_PARTITION option is disabled
    //! then the mount routine selects the first partition supported by file system. <br>
    //! After mount, the file list contains files and directories of ROOT directory
    //!

Definition at line 458 of file navigation.c.

References FALSE, fat_check_noopen(), fat_clear_entry_info_and_ptr(), fat_mount(), fs_g_nav, fs_g_nav_fast, FS_TYPE_FAT_UNM, TRUE, Fs_management::u32_cluster_sel_dir, and Fs_management_fast::u8_type_fat.

    00459 {
    00460    if ( !fat_check_noopen() )
    00461       return FALSE;
    00462
    00463    if( FS_TYPE_FAT_UNM != fs_g_nav_fast.u8_type_fat)
    00464    {
    00465       // Already mounted
    00466       // Go to root directory
    00467       fs_g_nav.u32_cluster_sel_dir   = 0;
    00468       // No file is selected by default
    00469       fat_clear_entry_info_and_ptr();
    00470       return TRUE;
    00471    }
    00472
    00473    return fat_mount();
    00474 }

Here is the call graph for this function:

U8 nav_partition_type | ( | void |  | ) |

This function gives the partition type.

Returns:
  partition type: FS_TYPE_FAT_12, FS_TYPE_FAT_16, FS_TYPE_FAT_32

  FS_TYPE_FAT_UNM, in case of error or unknow format

Definition at line 482 of file navigation.c.

References fat_check_device(), fs_g_nav_fast, FS_TYPE_FAT_UNM, nav_partition_mount(), and Fs_management_fast::u8_type_fat.

    00483 {
    00484    fat_check_device();
    00485    if( FS_TYPE_FAT_UNM == fs_g_nav_fast.u8_type_fat)
    00486    {
    00487       nav_partition_mount();
    00488    }
    00489    return fs_g_nav_fast.u8_type_fat;
    00490 }

Here is the call graph for this function:

Bool nav_partition_serialnumber | ( | Bool | b_action,
|  | U8 _MEM_TYPE_SLOW_ * | a_u8_sn |
| ) |  |  |

This function reads or writes the serial number on the selected partition.

Parameters:

  | b_action | to select the action FS_SN_READ to read serial number FS_SN_WRITE to write serial number
  | a_u8_sn | pointer on an array (4 bytes) if FS_SN_READ, then the array is used to store the serial number if FS_SN_WRITE, then the array is used to give the new serial number

Returns:
  FALSE in case of error, see global value "fs_g_status" for more detail

  TRUE otherwise

Definition at line 505 of file navigation.c.

References FALSE, fat_check_mount(), and fat_serialnumber().

    00506 {
    00507    if( !fat_check_mount())
    00508       return FALSE;
    00509
    00510    return fat_serialnumber( b_action , a_u8_sn );
    00511 }

Here is the call graph for this function:

Bool nav_partition_label | ( | Bool | b_action,
|  | FS_STRING | sz_label |
| ) |  |  |

This function reads or writes the label of selected partition.

Parameters:

  | b_action | to select the action FS_LABEL_READ to read label FS_LABEL_WRITE to write label
  | sz_label | pointer on a ASCII string (11 chars + NULL terminator =12 bytes) if FS_LABEL_READ, then the string is used to store label if FS_LABEL_WRITE, then the string is used to give the new label

Returns:
  FALSE in case of error, see global value "fs_g_status" for more detail

  TRUE otherwise

Definition at line 526 of file navigation.c.

References _MEM_TYPE_SLOW_, FALSE, fat_entry_label(), fat_read_dir(), FS_ERR_ENTRY_EMPTY, fs_g_nav_fast, fs_g_status, FS_LABEL_READ, FS_LABEL_WRITE, nav_dir_root(), nav_getindex(), nav_gotoindex(), NULL, TRUE, and Fs_management_fast::u16_entry_pos_sel_file.

    00527 {
    00528    _MEM_TYPE_SLOW_   Fs_index index;
    00529    Bool status = TRUE;
    00530
    00531    index = nav_getindex();    // Save current position
    00532
    00533    // Go to root dir
    00534    if( nav_dir_root())
    00535    {
    00536       // Find field label
    00537       fs_g_nav_fast.u16_entry_pos_sel_file = 0; // Go to first entry
    00538       while( 1 )
    00539       {
    00540          if ( !fat_read_dir())
    00541          {
    00542             status = FALSE;
    00543             break;               // error
    00544          }
    00545          if( fat_entry_label( FS_LABEL_READ , NULL ) )
    00546             break;
    00547          if( FS_ERR_ENTRY_EMPTY == fs_g_status )
    00548             break;
    00549          fs_g_nav_fast.u16_entry_pos_sel_file++;
    00550       }
    00551       if( TRUE == status )
    00552       {
    00553          // Find OK
    00554          if( FS_LABEL_READ == b_action )
    00555          {
    00556             // Read field label
    00557             if( !fat_entry_label( FS_LABEL_READ , sz_label ) )
    00558                sz_label[0]=0;    // empty name
    00559          }else{
    00560             // Change field label
    00561             status = fat_entry_label( FS_LABEL_WRITE , sz_label );
    00562          }
    00563       }
    00564    }
    00565    nav_gotoindex( &index );   // Restore the position
    00566    return status;
    00567 }

Here is the call graph for this function:

U32 nav_partition_space | ( | void |  | ) |

This function returns partition total space.

Returns:
  number of sectors

  0, in case of error

    //! You shall mounted the partition before call this routine
    //!

Definition at line 579 of file navigation.c.

References fat_check_device(), fs_g_nav, fs_g_nav_fast, FS_TYPE_FAT_UNM, Fs_management::u32_CountofCluster, Fs_management::u8_BPB_SecPerClus, and Fs_management_fast::u8_type_fat.

    00580 {
    00581    fat_check_device();
    00582    if (FS_TYPE_FAT_UNM == fs_g_nav_fast.u8_type_fat)
    00583       return 0;
    00584    return (fs_g_nav.u32_CountofCluster * fs_g_nav.u8_BPB_SecPerClus);
    00585 }

Here is the call graph for this function:

U8 nav_partition_cluster_size | ( | void |  | ) |

This function returns the partition cluster size.

Returns:
  cluster size (unit sector)

Definition at line 592 of file navigation.c.

References fs_g_nav, and Fs_management::u8_BPB_SecPerClus.

    00593 {
    00594    return fs_g_nav.u8_BPB_SecPerClus;
    00595 }

U32 nav_partition_freespace | ( | void |  | ) |

This function returns the partition free space.

Returns:
  number of free sectors

  0 in case of error or full partition

    //! You shall mounted the partition before call this routine
    //!

Definition at line 606 of file navigation.c.

References fat_check_device(), fat_getfreespace(), fs_g_nav_fast, FS_TYPE_FAT_UNM, and Fs_management_fast::u8_type_fat.

    00607 {
    00608    fat_check_device();
    00609    if (FS_TYPE_FAT_UNM == fs_g_nav_fast.u8_type_fat)
    00610       return 0;
    00611    return fat_getfreespace();
    00612 }

Here is the call graph for this function:

U8 nav_partition_freespace_percent | ( | void |  | ) |

This function returns the partition space free in percent.

Returns:
  percent of free space (0% to 100%)

  0% in case of error or full partition

    //! To speed up the compute, the resultat have an error delta of 1%
    //!

Definition at line 624 of file navigation.c.

References fat_check_device(), fat_getfreespace_percent(), fs_g_nav_fast, FS_TYPE_FAT_UNM, and Fs_management_fast::u8_type_fat.

    00625 {
    00626    fat_check_device();
    00627    if (FS_TYPE_FAT_UNM == fs_g_nav_fast.u8_type_fat)
    00628       return 0;
    00629    return fat_getfreespace_percent();
    00630 }

Here is the call graph for this function:

Bool nav_filelist_single_enable | ( | Bool | b_type | ) |

To display in File List only the files OR directories.

Parameters:

  | b_type | FS_DIR to display only directories presence FS_FILE to dispaly only files presence

Returns:
  FALSE in case of error, see global value "fs_g_status" for more detail

  TRUE otherwise

Definition at line 645 of file navigation.c.

References Fs_management::b_mode_nav, Fs_management::b_mode_nav_single, FALSE, fs_g_nav, nav_filelist_reset(), and TRUE.

    00646 {
    00647    if ( !nav_filelist_reset())
    00648       return FALSE;
    00649
    00650    fs_g_nav.b_mode_nav_single = TRUE;
    00651    fs_g_nav.b_mode_nav        = b_type;
    00652    return TRUE;
    00653 }

Here is the call graph for this function:

Bool nav_filelist_single_disable | ( | void |  | ) |

To display in File List the directories AND files.

Returns:
  FALSE in case of error, see global value "fs_g_status" for more detail

  TRUE otherwise

Definition at line 661 of file navigation.c.

References Fs_management::b_mode_nav_single, FALSE, fs_g_nav, and nav_filelist_reset().

    00662 {
    00663    fs_g_nav.b_mode_nav_single = FALSE;
    00664    return nav_filelist_reset();
    00665 }

Here is the call graph for this function:

Bool nav_filelist_reset | ( | void |  | ) |

This function resets the selection pointer, so "no file selected" in file list.

Returns:
  FALSE in case of error, see global value "fs_g_status" for more detail

  TRUE otherwise

Definition at line 673 of file navigation.c.

References FALSE, fat_check_mount_noopen(), fat_clear_entry_info_and_ptr(), and TRUE.

    00674 {
    00675    if ( !fat_check_mount_noopen())
    00676       return FALSE;
    00677
    00678    // No file selected and reset navigation
    00679    fat_clear_entry_info_and_ptr();
    00680    return TRUE;
    00681 }

Here is the call graph for this function:

Bool nav_filelist_validpos | ( | void |  | ) |

This function checks if a file is selected.

Returns:
  TRUE if a file is selected

  FALSE if no file is selected

Definition at line 689 of file navigation.c.

References fat_check_mount_select_noopen().

    00690 {
    00691    return fat_check_mount_select_noopen();
    00692 }

Here is the call graph for this function:

Bool nav_filelist_fileisnotopen | ( | void |  | ) |

This function checks if no file is open.

Returns:
  TRUE if no file is open

  FALSE if a file is open

Definition at line 700 of file navigation.c.

References fat_check_noopen().

    00701 {
    00702    return fat_check_noopen();
    00703 }

Here is the call graph for this function:

Bool nav_filelist_set | ( | U16 | u16_nb,
|  | Bool | b_direction |
| ) |  |  |

This function moves the selection pointer in file list.

Parameters:

  | u16_nb | numbers of file to jump before stopping action 0, stop at the first file found 1, stop at the second file found
  | b_direction | search direction FS_FIND_NEXT, move to next file or directory FS_FIND_PREV, move to previous file or directory

Returns:
  FALSE in case of error, see global value "fs_g_status" for more detail

  TRUE otherwise

    //! Note: if no file is selected then nav_filelist_set( 0 , FS_NEXT ) goes to the first entry of the file list.
    //!

Definition at line 723 of file navigation.c.

References Fs_management::b_mode_nav, Fs_management::b_mode_nav_single, FALSE, fat_check_mount_noopen(), fat_entry_check(), fat_get_entry_info(), fat_read_dir(), FS_DIR, FS_END_FIND, FS_ERR_ENTRY_EMPTY, FS_ERR_FS, FS_ERR_NO_FIND, FS_ERR_OUT_LIST, FS_FILE, FS_FIND_NEXT, fs_g_nav, fs_g_nav_fast, fs_g_status, FS_NO_SEL, TRUE, Fs_management_fast::u16_entry_pos_sel_file, and Fs_management::u16_pos_sel_file.

    00724 {
    00725    U16   u16_ptr_save_entry;
    00726    U16   u16_save_pos_sel_file;
    00727    Bool  b_save_entry_type;
    00728    Bool  b_find_last_entry = FALSE;
    00729
    00730    if ( !fat_check_mount_noopen())
    00731       return FALSE;
    00732
    00733    // Save the current selection
    00734    u16_ptr_save_entry      = fs_g_nav_fast.u16_entry_pos_sel_file;
    00735    u16_save_pos_sel_file   = fs_g_nav.u16_pos_sel_file;
    00736    b_save_entry_type       = fs_g_nav.b_mode_nav;
    00737
    00738    // Loop in directory
    00739    while( 1 )
    00740    {
    00741       if(( FS_FIND_NEXT == b_direction )
    00742       || ( b_find_last_entry ) )
    00743       {
    00744          if ( FS_END_FIND == fs_g_nav_fast.u16_entry_pos_sel_file )
    00745          {
    00746             // Too many files in directory (case impossible)
    00747             fs_g_status = FS_ERR_FS;
    00748             break;
    00749          }
    00750          fs_g_nav_fast.u16_entry_pos_sel_file++;      // Update entry position
    00751       }
    00752       else
    00753       {
    00754          if ( FS_NO_SEL == fs_g_nav_fast.u16_entry_pos_sel_file )
    00755          {
    00756             // No selected file then previous action impossible
    00757             fs_g_status = FS_ERR_NO_FIND;
    00758             break;
    00759          }
    00760          if ( 0 == fs_g_nav_fast.u16_entry_pos_sel_file )
    00761          {
    00762             // beginning of directory
    00763             if ( (FS_DIR == fs_g_nav.b_mode_nav ) || fs_g_nav.b_mode_nav_single )
    00764             {
    00765                // End of directory scan, then no previous action possible
    00766                fs_g_status = FS_ERR_NO_FIND;
    00767                break;
    00768             }
    00769             // End of file scan, then find last directory
    00770             b_find_last_entry = TRUE;
    00771          }else{
    00772             fs_g_nav_fast.u16_entry_pos_sel_file--;   // Update entry position
    00773          }
    00774       }
    00775
    00776       if( !fat_read_dir())
    00777       {
    00778          if( FS_ERR_OUT_LIST != fs_g_status )
    00779             break; // Error
    00780       }else{
    00781          if ( fat_entry_check( fs_g_nav.b_mode_nav ) )
    00782          {
    00783            // HERE, the file entry match with the type seached
    00784
    00785            if( b_find_last_entry )
    00786              continue;  // The search of last directory is on going then continue the search
    00787
    00788            // Update position in directory
    00789            if ( FS_FIND_NEXT == b_direction )
    00790               fs_g_nav.u16_pos_sel_file++;
    00791            else
    00792               fs_g_nav.u16_pos_sel_file--;
    00793
    00794            if (0 == u16_nb)
    00795            {
    00796               // It is the end of move then update file information
    00797               fat_get_entry_info();
    00798               return TRUE;         // NB FILE FIND
    00799            }
    00800            u16_nb--;
    00801            continue;
    00802          }
    00803       }
    00804
    00805       // Here error, check type of error
    00806       if(( FS_ERR_ENTRY_EMPTY == fs_g_status )
    00807       || ( FS_ERR_OUT_LIST    == fs_g_status ) )
    00808       {
    00809          // Here, end of the directory
    00810          if( b_find_last_entry )
    00811          {
    00812             // Re enable the previous command at the end of directory to find the last directory entry
    00813             b_find_last_entry = FALSE;
    00814             fs_g_nav.b_mode_nav = FS_DIR;
    00815             continue;
    00816          }
    00817          // Here, a next action is on going
    00818          if ( (FS_FILE == fs_g_nav.b_mode_nav) || fs_g_nav.b_mode_nav_single )
    00819          {
    00820             // End of next file action then end of next action
    00821             fs_g_status = FS_ERR_NO_FIND; // No file found
    00822             break;                        // end of search
    00823          }else{
    00824             // End of next dir action then starts the next file action at the beginning of directory
    00825             fs_g_nav_fast.u16_entry_pos_sel_file = 0xFFFF;
    00826             fs_g_nav.b_mode_nav = FS_FILE;
    00827          }
    00828       }
    00829    }  // end of loop while(1)
    00830
    00831    fs_g_nav.b_mode_nav                    = b_save_entry_type;
    00832    fs_g_nav_fast.u16_entry_pos_sel_file   = u16_ptr_save_entry;
    00833    fs_g_nav.u16_pos_sel_file              = u16_save_pos_sel_file;
    00834    return FALSE;
    00835 }

Here is the call graph for this function:

U16 nav_filelist_get | ( | void |  | ) |

This function returns the position of selected file in file list.

Returns:
  position of selected file (0 is the first position)

  FS_NO_SEL, in case of no file selected

Definition at line 843 of file navigation.c.

References fs_g_nav, and Fs_management::u16_pos_sel_file.

    00844 {
    00845    return fs_g_nav.u16_pos_sel_file;
    00846 }

Bool nav_filelist_goto | ( | U16 | u16_newpos | ) |

This function goes at a position in file list.

Parameters:

  | u16_newpos | new position to select (0 is the first position)

Returns:
  FALSE in case of error, see global value "fs_g_status" for more detail

  TRUE otherwise

Definition at line 856 of file navigation.c.

References FALSE, FS_FIND_NEXT, FS_FIND_PREV, FS_NO_SEL, nav_filelist_get(), nav_filelist_reset(), nav_filelist_set(), and TRUE.

    00857 {
    00858    U16 u16_current_pos;
    00859
    00860    if( FS_NO_SEL == u16_newpos )
    00861       return nav_filelist_reset();
    00862
    00863    u16_current_pos = nav_filelist_get();
    00864    if( u16_newpos < (u16_current_pos/2) )
    00865    {
    00866       // Restart at the beginning of list to accelerate the search
    00867       if( !nav_filelist_reset() )
    00868          return FALSE;
    00869       u16_current_pos = FS_NO_SEL;
    00870    }
    00871    if (FS_NO_SEL == u16_current_pos)
    00872    {
    00873       return nav_filelist_set( u16_newpos, FS_FIND_NEXT );
    00874    }
    00875    else
    00876    {
    00877       if (u16_newpos < u16_current_pos)
    00878       {
    00879          return nav_filelist_set( u16_current_pos -u16_newpos -1 , FS_FIND_PREV );
    00880       }
    00881       if (u16_newpos > u16_current_pos)
    00882       {
    00883          return nav_filelist_set( u16_newpos -u16_current_pos - 1 , FS_FIND_NEXT );
    00884       }
    00885    }
    00886    return TRUE;
    00887 }

Here is the call graph for this function:

Bool nav_filelist_findname | ( | const FS_STRING | sz_name,
|  | Bool | b_match_case |
| ) |  |  |

This function searchs a file name in file list.

Parameters:

  | sz_name | name to search (UNICODE or ASCII) It must be terminate by NULL or '*' value
  | b_match_case | FALSE to ignore the case

Returns:
  FALSE in case of error, see global value "fs_g_status" for more detail

  TRUE otherwise

    //! This function starts a search at the next position of the current in file list
    //!

Parameters:

  | sz_name | name to search (UNICODE or ASCII) It must be terminate by NULL or '*' value
  | b_match_case | FALSE to ignore the case

Returns:
  FALSE in case of error, see global value "fs_g_status" for more detail

  TRUE otherwise

    //! This function starts a search at the next position of the current in file list
    //!

Definition at line 903 of file navigation.c.

References FALSE, FS_FIND_NEXT, FS_NAME_CHECK, nav_file_name(), nav_filelist_set(), and TRUE.

    00904 {
    00905    while( 1 )
    00906    {
    00907       if ( !nav_filelist_set( 0, FS_FIND_NEXT ))
    00908          return FALSE;
    00909       if ( nav_file_name( sz_name , 0 , FS_NAME_CHECK , b_match_case ))
    00910          return TRUE;
    00911    }
    00912 }

Here is the call graph for this function:

Bool nav_filelist_eol | ( | void |  | ) |

This function checks the end of file list.

Returns:
  FALSE, NO end of file list

  TRUE, in case of end of list or error

Definition at line 920 of file navigation.c.

References Fs_management::b_mode_nav, FALSE, FS_DIR, FS_FIND_NEXT, FS_FIND_PREV, fs_g_nav, fs_g_nav_fast, FS_NO_SEL, nav_filelist_set(), TRUE, Fs_management_fast::u16_entry_pos_sel_file, and Fs_management::u16_pos_sel_file.

    00921 {
    00922    if( FALSE == nav_filelist_set( 0 , FS_FIND_NEXT ) )
    00923       return TRUE;   // End of list or error (remark: the position haven't changed)
    00924
    00925    if( 0 != fs_g_nav.u16_pos_sel_file )
    00926    {
    00927       // Go to previous position
    00928       nav_filelist_set( 0 , FS_FIND_PREV );
    00929    }else{
    00930       // No select file before, then reset position
    00931       fs_g_nav_fast.u16_entry_pos_sel_file= FS_NO_SEL;
    00932       fs_g_nav.u16_pos_sel_file           = FS_NO_SEL;
    00933       fs_g_nav.b_mode_nav                 = FS_DIR;
    00934    }
    00935    return FALSE;
    00936 }

Here is the call graph for this function:

Bool nav_filelist_bol | ( | void |  | ) |

This function checks the beginning of file list.

Returns:
  FALSE, it is not the beginning of file list

  TRUE, in case of the file selected is the first file, or in case of error

Definition at line 944 of file navigation.c.

References FALSE, FS_FIND_NEXT, FS_FIND_PREV, nav_filelist_set(), and TRUE.

    00945 {
    00946    if( FALSE == nav_filelist_set( 0 , FS_FIND_PREV ) )
    00947       return TRUE;   // End of list or error (remark: the position haven't changed)
    00948    // Go to previous position
    00949    nav_filelist_set( 0 , FS_FIND_NEXT );
    00950    return FALSE;
    00951 }

Here is the call graph for this function:

Bool nav_filelist_exist | ( | Bool | b_type | ) |

This function checks the presence of files or directories in file list.

Parameters:

  | b_type | FS_DIR to check the directory presence FS_FILE to check the file presence

Returns:
  TRUE, in case of a file or a directory exists

  FALSE, in case of no file or no directory exists, or error

Definition at line 962 of file navigation.c.

References FS_FIND_NEXT, fs_g_nav, FS_NO_SEL, nav_filelist_first(), nav_filelist_reset(), nav_filelist_set(), and Fs_management::u16_pos_sel_file.

    00963 {
    00964    Bool status;
    00965    U16   u16_save_position;
    00966
    00967    // Save current position
    00968    u16_save_position = fs_g_nav.u16_pos_sel_file;
    00969    // Go to first file or directory
    00970    status = nav_filelist_first( b_type );
    00971    // Restore previous position
    00972    nav_filelist_reset();
    00973    if ( u16_save_position != FS_NO_SEL )
    00974    {
    00975       nav_filelist_set( u16_save_position , FS_FIND_NEXT );
    00976    }
    00977    return status;
    00978 }

Here is the call graph for this function:

U16 nav_filelist_nb | ( | Bool | b_type | ) |

This function computes the number of files or directories in file list.

Parameters:

  | b_type | FS_DIR to compute the number of directories FS_FILE to compute the number of files

Returns:
  number of files or directories in file list

Definition at line 988 of file navigation.c.

References Fs_management::b_mode_nav, FS_FILE, FS_FIND_NEXT, fs_g_nav, FS_NO_SEL, nav_filelist_reset(), nav_filelist_set(), and Fs_management::u16_pos_sel_file.

    00989 {
    00990    U16   u16_save_position;
    00991    U16   u16_save_number_dir;
    00992    U16   u16_save_number_file;
    00993
    00994    // Save current position
    00995    u16_save_position = fs_g_nav.u16_pos_sel_file;
    00996    // Reset position
    00997    if ( !nav_filelist_reset())
    00998       return 0;
    00999    // Scan all directory
    01000    u16_save_number_dir  = 0;
    01001    u16_save_number_file = 0;
    01002    while( nav_filelist_set( 0 , FS_FIND_NEXT ) )
    01003    {
    01004       if( FS_FILE == fs_g_nav.b_mode_nav )
    01005          u16_save_number_file++;    // It is a file
    01006       else
    01007          u16_save_number_dir++;     // It is a directory
    01008    }
    01009    // Restore previous position
    01010    nav_filelist_reset();
    01011    if ( u16_save_position != FS_NO_SEL )
    01012    {
    01013       nav_filelist_set( u16_save_position , FS_FIND_NEXT );
    01014    }
    01015    // Return the value asked
    01016    if( FS_FILE == b_type )
    01017       return u16_save_number_file;
    01018    else
    01019       return u16_save_number_dir;
    01020 }

Here is the call graph for this function:

Bool nav_filelist_first | ( | Bool | b_type | ) |

This function goes to at the first file or directory in file list.

Parameters:

  | b_type | FS_DIR to go at the first directory FS_FILE to go at the first file

Returns:
  FALSE in case of error, see global value "fs_g_status" for more detail

  TRUE otherwise

Definition at line 1031 of file navigation.c.

References Fs_management::b_mode_nav, FALSE, FS_ERR_NO_FIND, FS_FIND_NEXT, fs_g_nav, fs_g_status, nav_filelist_reset(), nav_filelist_set(), and TRUE.

    01032 {
    01033    // Reset position
    01034    if ( !nav_filelist_reset())
    01035       return FALSE;
    01036    // Find the first file or directory
    01037    while( nav_filelist_set( 0 , FS_FIND_NEXT ) )
    01038    {
    01039       if( b_type == fs_g_nav.b_mode_nav )
    01040          return TRUE;   // First file or directory found
    01041    }
    01042    fs_g_status = FS_ERR_NO_FIND;
    01043    return FALSE;
    01044 }

Here is the call graph for this function:

Bool nav_filelist_last | ( | Bool | b_type | ) |

This function goes to at the last file or directory in file list.

Parameters:

  | b_type | FS_DIR to go at the last directory FS_FILE to go at the last file

Returns:
  FALSE in case of error, see global value "fs_g_status" for more detail

  TRUE otherwise

Definition at line 1055 of file navigation.c.

References FALSE, FS_ERR_NO_FIND, FS_FIND_NEXT, fs_g_status, nav_filelist_first(), nav_filelist_nb(), nav_filelist_set(), and TRUE.

    01056 {
    01057    U16 u16_nb;
    01058
    01059    // Get number of file or directory
    01060    u16_nb = nav_filelist_nb( b_type  );
    01061    if( 0 == u16_nb )
    01062    {
    01063       fs_g_status = FS_ERR_NO_FIND;
    01064       return FALSE;  // NO FILE FOUND
    01065    }
    01066    // Go to the first file or directory
    01067    if ( !nav_filelist_first( b_type ))
    01068       return FALSE;
    01069    // If there are more one file or directory, then go to at the last of list
    01070    if( 1 == u16_nb )
    01071       return TRUE;
    01072    u16_nb -= 2;
    01073    return nav_filelist_set( u16_nb , FS_FIND_NEXT );
    01074 }

Here is the call graph for this function:

Fs_index nav_getindex | ( | void |  | ) |

This function returns a small index on the selected file.

Returns:
  It is a small index structure with information on selected file (disk, partition, dir, file/dir selected)

    //! This routine is interresting to save a file position in small variable.
    //! This pointer allow to reinit a navigator quickly with nav_gotoindex() routine.
    //!

Definition at line 1090 of file navigation.c.

References fs_g_nav, fs_g_nav_fast, Fs_management_fast::u16_entry_pos_sel_file, Fs_index::u16_entry_pos_sel_file, Fs_management::u32_cluster_sel_dir, Fs_index::u32_cluster_sel_dir, Fs_management::u8_lun, Fs_index::u8_lun, Fs_management::u8_partition, and Fs_index::u8_partition.

    01091 {
    01092    Fs_index index;
    01093
    01094    // Fill index structure
    01095    index.u8_lun                  = fs_g_nav.u8_lun;
    01096 #if (FS_MULTI_PARTITION  ==  ENABLED)
    01097    index.u8_partition            = fs_g_nav.u8_partition;
    01098 #endif
    01099    index.u32_cluster_sel_dir     = fs_g_nav.u32_cluster_sel_dir;
    01100    index.u16_entry_pos_sel_file  = fs_g_nav_fast.u16_entry_pos_sel_file;
    01101    return index;
    01102 }

Bool nav_gotoindex | ( | const Fs_index _MEM_TYPE_SLOW_ * | index | ) |

This function selects a file in the navigator via a file index.

Parameters:

  | index | structure with information about file to select (disk, partition, dir, file/dir selected )

Returns:
  FALSE in case of error, see global value "fs_g_status" for more detail

  TRUE otherwise

    //! This routine allow to reinit a navigator quickly via a file index (disk, partition, dir, file/dir selected )
    //! To get a file index, you shall used the routine nav_getindex().
    //!

Definition at line 1117 of file navigation.c.

References FALSE, FS_FIND_NEXT, fs_g_nav, fs_g_nav_fast, nav_drive_set(), nav_filelist_reset(), nav_filelist_set(), nav_partition_mount(), nav_partition_set(), TRUE, Fs_management_fast::u16_entry_pos_sel_file, and Fs_management::u32_cluster_sel_dir.

    01118 {
    01119    // Select the drive and partition corresponding at file index
    01120    if( !nav_drive_set( index->u8_lun ))
    01121       return FALSE;
    01122 #if (FS_MULTI_PARTITION  ==  ENABLED)
    01123    if( !nav_partition_set(index->u8_partition))
    01124       return FALSE;
    01125 #endif
    01126    if( !nav_partition_mount())
    01127       return FALSE;
    01128
    01129    // Select the directory corresponding at file index
    01130    fs_g_nav.u32_cluster_sel_dir   = index->u32_cluster_sel_dir;
    01131
    01132    // Search the file position corresponding at file index
    01133    if ( !nav_filelist_reset())
    01134       return FALSE;
    01135    while( fs_g_nav_fast.u16_entry_pos_sel_file != index->u16_entry_pos_sel_file )
    01136    {
    01137       if( !nav_filelist_set( 0 , FS_FIND_NEXT ) )
    01138       {
    01139          nav_filelist_reset();
    01140          return FALSE;
    01141       }
    01142    }
    01143    return TRUE;
    01144 }

Here is the call graph for this function:

Bool nav_dir_root | ( | void |  | ) |

This function initializes the file list on the root directory.

Returns:
  FALSE in case of error, see global value "fs_g_status" for more detail

  TRUE otherwise

Definition at line 1156 of file navigation.c.

References nav_partition_mount().

    01157 {
    01158    return nav_partition_mount();
    01159 }

Here is the call graph for this function:

Bool nav_dir_is_root | ( | void |  | ) |

This function check the current directory.

Returns:
  FALSE the current directory selected is not the root directory

  TRUE the current directory selected is the root directory

Definition at line 1167 of file navigation.c.

References FALSE, fat_check_mount_noopen(), fs_g_nav, and Fs_management::u32_cluster_sel_dir.

    01168 {
    01169    if (!fat_check_mount_noopen())
    01170       return FALSE;
    01171
    01172    return (0 == fs_g_nav.u32_cluster_sel_dir);
    01173 }

Here is the call graph for this function:

Bool nav_dir_cd | ( | void |  | ) |

This function enters in the selected directory in file list.

Returns:
  FALSE in case of error, see global value "fs_g_status" for more detail

  TRUE otherwise

    //! After this routine the file list changes and contains the files and directories of the new directory.
    //! By default no file is selected.
    //!

Definition at line 1186 of file navigation.c.

References FALSE, fat_check_mount_select_noopen(), fat_entry_is_dir(), fs_g_nav, fs_g_nav_entry, fs_g_nav_fast, nav_filelist_reset(), TRUE, Fs_management::u16_entry_pos_sel_dir, Fs_management_fast::u16_entry_pos_sel_file, Fs_management_entry::u32_cluster, and Fs_management::u32_cluster_sel_dir.

    01187 {
    01188    if ( !fat_check_mount_select_noopen())
    01189       return FALSE;
    01190
    01191    // The current selection, is it a directory ?
    01192    if ( !fat_entry_is_dir())
    01193       return FALSE;
    01194
    01195    // Select the current directory
    01196    fs_g_nav.u16_entry_pos_sel_dir = fs_g_nav_fast.u16_entry_pos_sel_file;
    01197    fs_g_nav.u32_cluster_sel_dir = fs_g_nav_entry.u32_cluster;
    01198
    01199    // Reset file list
    01200    if( FALSE == nav_filelist_reset())
    01201       return FALSE;
    01202    return TRUE;
    01203 }

Here is the call graph for this function:

Bool nav_dir_gotoparent | ( | void |  | ) |

This function goes to the parent directory.

Returns:
  FALSE in case of error, see global value "fs_g_status" for more detail

  TRUE otherwise

    //! After, the file list changes and contains the files and directories of the new directory.
    //! By default, the file selected in file list is the previous (children) directory.
    //!

Definition at line 1216 of file navigation.c.

References Fs_management::b_mode_nav, Fs_management::b_mode_nav_single, FALSE, fat_check_mount_noopen(), fat_get_entry_info(), fat_read_dir(), FS_DIR, FS_ERR_FS, FS_ERR_IS_ROOT, FS_FIND_NEXT, fs_g_nav, fs_g_nav_entry, fs_g_nav_fast, fs_g_status, nav_filelist_reset(), nav_filelist_set(), TRUE, Fs_management_fast::u16_entry_pos_sel_file, Fs_management_entry::u32_cluster, and Fs_management::u32_cluster_sel_dir.

    01217 {
    01218    U32 u32_cluster_old_dir;
    01219
    01220    if (!fat_check_mount_noopen())
    01221       return FALSE;
    01222
    01223    if (0 == fs_g_nav.u32_cluster_sel_dir)
    01224    {
    01225       fs_g_status = FS_ERR_IS_ROOT;        // There aren't parent
    01226       return FALSE;
    01227    }
    01228
    01229    // Select and read information about directory ".."
    01230    fs_g_nav_fast.u16_entry_pos_sel_file = 1;
    01231    if ( !fat_read_dir())
    01232       return FALSE;
    01233    fat_get_entry_info();
    01234    // Save the children directory cluster
    01235    u32_cluster_old_dir = fs_g_nav.u32_cluster_sel_dir;
    01236
    01237    // Select the parent directory via information present in the current directory ".."
    01238    fs_g_nav.u32_cluster_sel_dir = fs_g_nav_entry.u32_cluster;
    01239
    01240    // Select the children directory in new directory (=parent directory)
    01241    if( FALSE == nav_filelist_reset())
    01242       return FALSE;
    01243    if( fs_g_nav.b_mode_nav_single && (FS_DIR != fs_g_nav.b_mode_nav) )
    01244       return TRUE;
    01245
    01246    while( nav_filelist_set( 0 , FS_FIND_NEXT ) )
    01247    {
    01248       if (fs_g_nav_entry.u32_cluster == u32_cluster_old_dir)
    01249          return TRUE;         // It is the children directory
    01250    }
    01251    fs_g_status = FS_ERR_FS;
    01252    return FALSE;
    01253 }

Here is the call graph for this function:

Bool nav_dir_name | ( | FS_STRING | sz_path,
|  | U8 | u8_size_max |
| ) |  |  |

This function returns the directory name corresponding at the file list.

Parameters:

  | sz_path | string to store the name (ASCII or UNICODE )
  | u8_size_max | string size (unit ASCII or UNICODE )

Returns:
  FALSE in case of error, see global value "fs_g_status" for more detail

  TRUE otherwise

Definition at line 1264 of file navigation.c.

References Fs_management::b_mode_nav, Fs_management::b_mode_nav_single, FALSE, fat_check_mount_noopen(), FS_FILE, fs_g_nav, fs_g_nav_entry, fs_g_nav_fast, FS_NAME_GET, g_b_string_length, Is_unicode, nav_dir_gotoparent(), nav_drive_getname(), nav_file_name(), TRUE, Fs_management::u16_entry_pos_sel_dir, Fs_management_fast::u16_entry_pos_sel_file, Fs_management_entry::u32_cluster, Fs_management::u32_cluster_sel_dir, Fs_management_entry::u32_size, and Fs_management_entry::u8_attr.

    01265 {
    01266    U8 u8_i, u8_character;
    01267    Bool status = FALSE;
    01268    U16 save_u16_entry_pos_sel_file;
    01269    U32 save_u32_cluster_sel_dir;
    01270    U8  save_u8_attr          ;
    01271    U32 save_u32_cluster      ;
    01272    U32 save_u32_size         ;
    01273    Bool b_mode_nav_single_save;
    01274    Bool b_mode_nav_mode_save;
    01275
    01276    if ( !fat_check_mount_noopen())
    01277       return FALSE;
    01278
    01279    if (0 != fs_g_nav.u32_cluster_sel_dir)
    01280    {
    01281       // Save context
    01282       save_u16_entry_pos_sel_file= fs_g_nav_fast.u16_entry_pos_sel_file;
    01283       save_u32_cluster_sel_dir   = fs_g_nav.u32_cluster_sel_dir        ;
    01284       save_u8_attr               = fs_g_nav_entry.u8_attr              ;
    01285       save_u32_cluster           = fs_g_nav_entry.u32_cluster          ;
    01286       save_u32_size              = fs_g_nav_entry.u32_size             ;
    01287       b_mode_nav_single_save = fs_g_nav.b_mode_nav_single;
    01288       b_mode_nav_mode_save   = fs_g_nav.b_mode_nav;
    01289       fs_g_nav.b_mode_nav_single = TRUE;
    01290       fs_g_nav.b_mode_nav = FS_FILE;
    01291       // Go to parent directory and select the children directory
    01292       if( !nav_dir_gotoparent() )
    01293       {
    01294          fs_g_nav.b_mode_nav_single = b_mode_nav_single_save;
    01295          fs_g_nav.b_mode_nav = b_mode_nav_mode_save;
    01296          return FALSE;
    01297       }
    01298       fs_g_nav.b_mode_nav_single = b_mode_nav_single_save ;
    01299       fs_g_nav.b_mode_nav = b_mode_nav_mode_save;
    01300       // Go to directory name position
    01301       fs_g_nav_fast.u16_entry_pos_sel_file = fs_g_nav.u16_entry_pos_sel_dir;
    01302       status = nav_file_name( sz_path  , u8_size_max , FS_NAME_GET , FALSE  );
    01303       // Restore previous context
    01304       fs_g_nav_fast.u16_entry_pos_sel_file= save_u16_entry_pos_sel_file;
    01305       fs_g_nav.u32_cluster_sel_dir        = save_u32_cluster_sel_dir   ;
    01306       fs_g_nav_entry.u8_attr              = save_u8_attr               ;
    01307       fs_g_nav_entry.u32_cluster          = save_u32_cluster           ;
    01308       fs_g_nav_entry.u32_size             = save_u32_size              ;
    01309    }
    01310    else
    01311    {
    01312       // No parent directory, then it is the root directory
    01313       if( g_b_string_length )
    01314       {
    01315          ((FS_STR_UNICODE)sz_path )[0] = 3;  // 3 chars for path "x:"
    01316          status = TRUE;
    01317       }else
    01318
    01319       // Create a device name
    01320       for( u8_i = 0 ; u8_i<3 ; u8_i++ )
    01321       {
    01322          switch( u8_i )
    01323          {
    01324             case 0:
    01325             u8_character = nav_drive_getname();    // Letter
    01326             break;
    01327             case 1:
    01328             u8_character = ':';                     // ":"
    01329             break;
    01330             case 2:
    01331             default:
    01332             u8_character = 0;                       // end of string
    01333             break;
    01334          }
    01335          if( Is_unicode )
    01336          {
    01337             ((FS_STR_UNICODE)sz_path )[0] = u8_character;
    01338          }else{
    01339             sz_path [0] = u8_character;
    01340          }
    01341          sz_path  += (Is_unicode? 2 : 1 );
    01342       }
    01343       status = TRUE;
    01344
    01345    }
    01346    return status;
    01347 }

Here is the call graph for this function:

Bool nav_dir_make | ( | const FS_STRING | sz_name | ) |

This function creates a directory in the directory corresponding at file list.

Parameters:

  | sz_name | directory name (ASCII or UNICODE )

Returns:
  FALSE in case of error, see global value "fs_g_status" for more detail

  TRUE otherwise

Referenced by copy_dir(), nav_setcwd(), ushell_cmd_mkdir(), and ushell_cmd_sync().

Here is the caller graph for this function:

Bool nav_getcwd | ( | FS_STRING | sz_path,
|  | U8 | u8_size_path,
|  | Bool | b_view_file_select |
| ) |  |  |

This function returns the full path of the selection.

Parameters:

  | sz_path | string to store the path (ASCII or UNICODE )
  | u8_size_path | string size (unit ASCII or UNICODE )
  | b_view_file_select | TRUE, to include in path the selected file name

Returns:
  FALSE in case of error, see global value "fs_g_status" for more detail

  TRUE otherwise

Definition at line 1408 of file navigation.c.

References _MEM_TYPE_SLOW_, FALSE, fat_check_mount_noopen(), fat_check_select(), FS_ERR_BUFFER_FULL, FS_ERR_IS_ROOT, fs_g_status, FS_NAME_GET, g_b_string_length, Is_unicode, nav_dir_gotoparent(), nav_drive_getname(), nav_file_name(), nav_getindex(), nav_gotoindex(), and TRUE.

    01409 {
    01410    _MEM_TYPE_SLOW_   Fs_index index;
    01411    _MEM_TYPE_SLOW_   U16 u16_lgt=0;    // Only used if LENGTH string mode enabled
    01412    U8 u8_save_size_path=0, u8_i;
    01413    Bool status = FALSE;                // Error by default
    01414
    01415    if ( !fat_check_mount_noopen())
    01416       return FALSE;
    01417
    01418    index = nav_getindex();             // Save current position
    01419
    01420    if( g_b_string_length )
    01421    {
    01422       u16_lgt = 1;   // 1 for NULL terminate
    01423    }
    01424    else
    01425    {
    01426       u8_save_size_path = u8_size_path;
    01427       // Set NULL terminator at the end of path
    01428       u8_size_path--;
    01429       if( Is_unicode )
    01430       {
    01431          ((FS_STR_UNICODE)sz_path )[u8_size_path] = 0;
    01432       }else{
    01433          sz_path [u8_size_path]   = 0;
    01434       }
    01435    }
    01436
    01437    // For each directory of path
    01438    while( 1 )
    01439    {
    01440       if( b_view_file_select )
    01441       {
    01442          // Write the selected file or directory in path
    01443          b_view_file_select = FALSE;
    01444          if( !fat_check_select() )
    01445             continue;   // No selected file or directory, then restart loop to go at the first directory of path
    01446       }
    01447       else
    01448       {
    01449          // Go to parent directory and selects the children directory
    01450          if( !nav_dir_gotoparent() )
    01451             break;
    01452       }
    01453
    01454       // Read name of selected file or directory
    01455       if( !nav_file_name( sz_path  , u8_size_path , FS_NAME_GET, FALSE  ))
    01456          break;
    01457
    01458       if( g_b_string_length )
    01459       {
    01460          // Update total length
    01461          u16_lgt += ((FS_STR_UNICODE)sz_path )[0]; // 0 = -1 to remove NULL terminated and +1 for '\\'
    01462          continue;
    01463       }
    01464
    01465       // Compute the size of name
    01466       u8_i = 0;
    01467       while( 1 )
    01468       {
    01469          if( Is_unicode )
    01470          {
    01471             if( 0 == ((FS_STR_UNICODE)sz_path )[u8_i])
    01472                break;
    01473          }else{
    01474             if( 0 == sz_path [u8_i])
    01475                break;
    01476          }
    01477          u8_i++;
    01478       }
    01479
    01480       // Check the string size
    01481       if( (u8_i+1) == u8_size_path )
    01482       {
    01483          fs_g_status = FS_ERR_BUFFER_FULL;   // The path string is full
    01484          break;
    01485       }
    01486
    01487       // Move the name at the end of path
    01488       while( 0 != u8_i )
    01489       {
    01490          u8_i--;
    01491          u8_size_path--;
    01492          if( Is_unicode )
    01493          {
    01494             ((FS_STR_UNICODE)sz_path )[u8_size_path] = ((FS_STR_UNICODE)sz_path )[u8_i];
    01495          }else{
    01496             sz_path [u8_size_path]   = sz_path [u8_i];
    01497          }
    01498       }
    01499       // Set '\' char before the name
    01500       u8_size_path--;
    01501       if( Is_unicode )
    01502       {
    01503          ((FS_STR_UNICODE)sz_path )[u8_size_path] = '\\';
    01504       }else{
    01505          sz_path [u8_size_path]   = '\\';
    01506       }
    01507    }
    01508
    01509    if ( FS_ERR_IS_ROOT == fs_g_status )
    01510    {
    01511       if( g_b_string_length )
    01512       {
    01513          // Update and write total length
    01514          ((FS_STR_UNICODE)sz_path )[0] = u16_lgt +2 ; //+2 for "x:"
    01515          status = TRUE;
    01516       }
    01517       else
    01518       {
    01519          // End of path then add device name
    01520          if( 2 > u8_size_path )
    01521          {
    01522             fs_g_status = FS_ERR_BUFFER_FULL;   // The path string is full
    01523          }
    01524          else
    01525          {
    01526             // Create a device name
    01527             if( Is_unicode )
    01528             {
    01529                ((FS_STR_UNICODE)sz_path )[0] = nav_drive_getname();    // Letter
    01530                ((FS_STR_UNICODE)sz_path )[1] = ':';                   // ":"
    01531             }else{
    01532                sz_path [0] = nav_drive_getname();    // Letter
    01533                sz_path [1] = ':';                      // ":"
    01534             }
    01535
    01536             // The path is stored at the end, then move the path at the beginning
    01537             u8_i = 2;
    01538             while( u8_save_size_path != u8_size_path )
    01539             {
    01540                if( Is_unicode )
    01541                {
    01542                   ((FS_STR_UNICODE)sz_path )[u8_i] = ((FS_STR_UNICODE)sz_path )[u8_size_path];
    01543                }else{
    01544                   sz_path [u8_i] = sz_path [u8_size_path];
    01545                }
    01546                u8_i++;
    01547                u8_size_path++;
    01548             }
    01549             status = TRUE;
    01550          }
    01551       }
    01552    } // else Error system
    01553
    01554    nav_gotoindex( &index );   // Restore the position
    01555    return status;
    01556 }

Here is the call graph for this function:

Bool nav_setcwd | ( | FS_STRING | sz_path,
|  | Bool | b_match_case,
|  | Bool | b_create |
| ) |  |  |

This function selects a disk position via a path.

Parameters:

  | sz_path | path string (ASCII or UNICODE )
  | b_match_case | FALSE to ignore the case
  | b_create | TRUE, if path no exists then create it FALSE, no create path

Returns:
  FALSE in case of error, see global value "fs_g_status" for more detail

  TRUE otherwise

    //! The syntact "./../../file_name" is supported.
    //! With syntact "./dir_parent/directory_name"  the file list corresponding at "dir_parent" and "directory_name" is selected.
    //! With syntact "./dir_parent/directory_name/" the file list corresponding at "directory_name" and no file is selected.
    //!

Definition at line 1575 of file navigation.c.

References _MEM_TYPE_SLOW_, FALSE, fat_check_noopen(), fat_entry_is_dir(), Is_unicode, nav_dir_cd(), nav_dir_gotoparent(), nav_dir_make(), nav_dir_root(), nav_drive_set(), nav_file_create(), nav_filelist_findname(), nav_filelist_reset(), nav_getindex(), nav_gotoindex(), nav_partition_mount(), and TRUE.

    01576 {
    01577    _MEM_TYPE_SLOW_   Fs_index index;
    01578 #if (FSFEATURE_WRITE == (FS_LEVEL_FEATURES & FSFEATURE_WRITE)) ||              \
    01579     (FSFEATURE_WRITE_COMPLET == (FS_LEVEL_FEATURES & FSFEATURE_WRITE_COMPLET))
    01580    FS_STRING sz_save_path = 0;
    01581 #endif
    01582    Bool b_create_name = FALSE;
    01583
    01584    if ( !fat_check_noopen())
    01585       return FALSE;
    01586
    01587    index = nav_getindex();             // Save current position
    01588
    01589    // Check syntact "\path..."
    01590    if( (( Is_unicode) && (('\\'  == ((FS_STR_UNICODE)sz_path )[0]) || ('/'  == ((FS_STR_UNICODE)sz_path )[0])) )
    01591    ||  ((!Is_unicode) && (('\\'  == sz_path [0]) || ('/'  == sz_path [0])) ) )
    01592    {
    01593       // Go to the root of current drive
    01594       if( !nav_dir_root())
    01595          goto nav_setcwd_fail;
    01596       sz_path  += (Is_unicode? 2 : 1 );
    01597    }else
    01598
    01599    // Check syntact "x:\path..."
    01600    if( (( Is_unicode) && (( ':'  == ((FS_STR_UNICODE)sz_path )[1] ) && (('\\'  == ((FS_STR_UNICODE)sz_path )[2] ) || ('/'  == ((FS_STR_UNICODE)sz_path )[2]))) )
    01601    ||  ((!Is_unicode) && (( ':'  == sz_path [1] ) && (('\\'  == sz_path [2] ) || ('/'  == sz_path [2]))) ) )
    01602    {
    01603       // Go to the drive
    01604       if( Is_unicode )
    01605       {
    01606          if( !nav_drive_set( toupper(((FS_STR_UNICODE)sz_path )[0])-'A' ) )
    01607             goto nav_setcwd_fail;
    01608       }else{
    01609          if( !nav_drive_set( toupper(sz_path [0])-'A' ) )
    01610             goto nav_setcwd_fail;
    01611       }
    01612       if( !nav_partition_mount())
    01613          goto nav_setcwd_fail;
    01614       sz_path  += 3*(Is_unicode? 2 : 1 );
    01615    }else
    01616
    01617    // Check syntact ".\path..."
    01618    if( (( Is_unicode) && (( '.'  == ((FS_STR_UNICODE)sz_path )[0] ) && (('\\'  == ((FS_STR_UNICODE)sz_path )[1] ) || ('/'  == ((FS_STR_UNICODE)sz_path )[1] ))) )
    01619    ||  ((!Is_unicode) && (( '.'  == sz_path [0] ) && (('\\'  == sz_path [1] ) || ('/'  == sz_path [1] ))) ) )
    01620    {
    01621       // Search in current directory
    01622       sz_path  += 2*(Is_unicode? 2 : 1 );
    01623    }else
    01624
    01625    {
    01626       // Check syntact "..\..\path..."
    01627       if( Is_unicode )
    01628       {
    01629          while(( '.'  == ((FS_STR_UNICODE)sz_path )[0] )
    01630          &&    ( '.'  == ((FS_STR_UNICODE)sz_path )[1] )
    01631          &&    (('\\'  == ((FS_STR_UNICODE)sz_path )[2]) || ('/'  == ((FS_STR_UNICODE)sz_path )[2]) || (0  == ((FS_STR_UNICODE)sz_path )[2])) )
    01632          {
    01633             // Go to parent directory
    01634             if( !nav_dir_gotoparent() )
    01635                goto nav_setcwd_fail;
    01636             sz_path  += (2*2); // jump ".."
    01637             if( 0 != ((FS_STR_UNICODE)sz_path )[0])
    01638                sz_path  += (2*1); // jump "/"
    01639          }
    01640       }else{
    01641          while(( '.'  == sz_path [0] )
    01642          &&    ( '.'  == sz_path [1] )
    01643          &&    (('\\'  == sz_path [2]) || ('/'  == sz_path [2]) || (0  == sz_path [2])) )
    01644          {
    01645          // Go to parent directory
    01646          if( !nav_dir_gotoparent() )
    01647             goto nav_setcwd_fail;
    01648             sz_path  += 2; // jump ".."
    01649             if( 0 != sz_path [0])
    01650                sz_path  +=1; // jump "/"
    01651          }
    01652       }
    01653    }
    01654
    01655    // Reset list to start the search at the beginning
    01656    if( !nav_filelist_reset())
    01657       goto nav_setcwd_fail;
    01658
    01659    while( 1 )
    01660    {
    01661       if( (( Is_unicode) && ( 0 == ((FS_STR_UNICODE)sz_path )[0] ) )
    01662       ||  ((!Is_unicode) && ( 0 == sz_path [0] ) ) )
    01663       {
    01664          return TRUE;   // path (without file) is found or create
    01665       }
    01666       if( !nav_filelist_findname( sz_path  , b_match_case  ))
    01667       {
    01668          // The file or directory is not found
    01669          if( !b_create )
    01670             goto nav_setcwd_fail;   // don't creat the directory then exit
    01671          // Set flag to create the directory
    01672          b_create_name = TRUE;
    01673 #if (FSFEATURE_WRITE == (FS_LEVEL_FEATURES & FSFEATURE_WRITE)) ||              \
    01674     (FSFEATURE_WRITE_COMPLET == (FS_LEVEL_FEATURES & FSFEATURE_WRITE_COMPLET))
    01675          sz_save_path = sz_path;
    01676 #endif
    01677       }
    01678
    01679       while( 1 )
    01680       {
    01681          sz_path  += (Is_unicode? 2 : 1 );
    01682          if( (( Is_unicode) && ( 0 == ((FS_STR_UNICODE)sz_path )[0] ) )
    01683          ||  ((!Is_unicode) && ( 0 == sz_path [0] ) ) )
    01684          {
    01685             // Is it the last name of path and it is a file
    01686             if( b_create_name )
    01687             {
    01688 #if (FSFEATURE_WRITE == (FS_LEVEL_FEATURES & FSFEATURE_WRITE))
    01689                // The file must be created
    01690                if( !nav_file_create( sz_save_path ) )
    01691                   goto nav_setcwd_fail;
    01692 #else
    01693                goto nav_setcwd_fail;
    01694 #endif
    01695             }
    01696             break;   // The file include in path is found or created, then end of set_cwd
    01697          }
    01698
    01699          if( (( Is_unicode) && (('\\' == ((FS_STR_UNICODE)sz_path )[0] ) || ('/' == ((FS_STR_UNICODE)sz_path )[0] )) )
    01700          ||  ((!Is_unicode) && (('\\' == sz_path [0] ) || ('/' == sz_path [0] )) ) )
    01701          {
    01702             // Is it a folder name
    01703             if( b_create_name )
    01704             {
    01705 #if (FSFEATURE_WRITE_COMPLET == (FS_LEVEL_FEATURES & FSFEATURE_WRITE_COMPLET))
    01706                // The folder doesn't exist and it must be created
    01707                if( !nav_dir_make( sz_save_path ))
    01708                   goto nav_setcwd_fail;
    01709 #else
    01710                goto nav_setcwd_fail;
    01711 #endif
    01712             }
    01713             if( !fat_entry_is_dir() )
    01714                goto nav_setcwd_fail;
    01715             // jump '\'
    01716             sz_path  += (Is_unicode? 2 : 1 );
    01717             if( !nav_dir_cd())
    01718                goto nav_setcwd_fail;
    01719             break;
    01720          }
    01721       }
    01722
    01723    }
    01724
    01725 nav_setcwd_fail:
    01726    nav_gotoindex( &index );   // Restore the position
    01727    return FALSE;
    01728 }

Here is the call graph for this function:

Bool nav_file_getname | ( | FS_STRING | sz_name,
|  | U8 | u8_size_max |
| ) |  |  |

This function returns the name of selected file.

Parameters:

  | sz_name | string to store the name file (ASCII or UNICODE )
  | u8_size_max | string size (unit ASCII or UNICODE )

Returns:
  FALSE in case of error, see global value "fs_g_status" for more detail

  TRUE otherwise

Definition at line 1745 of file navigation.c.

References FALSE, FS_NAME_GET, and nav_file_name().

    01746 {
    01747    return nav_file_name( sz_name, u8_size_max, FS_NAME_GET, FALSE );
    01748 }

Here is the call graph for this function:

Bool nav_file_name | ( | FS_STRING | sz_name,
|  | U8 | u8_size_max,
|  | Bool | b_mode,
|  | Bool | b_match_case |
| ) |  |  |

This function returns the name of selected file or checks the string with the name of selected file.

Parameters:

  | b_mode | action mode: FS_NAME_GET to get the name of selected file FS_NAME_CHECK to check the name of selected file
  | sz_name | if FS_NAME_GET then string to store the file name (ASCII or UNICODE ) if FS_NAME_CHECK then string to match with file name (ASCII or UNICODE), it must be terminated by NULL or '*' value
  | b_match_case | FALSE, ignore the case (only used in "FS_NAME_CHECK" action)
  | u8_size_max | string size (unit ASCII or UNICODE ), only used in "FS_NAME_GET" action

Returns:
  FALSE in case of error, see global value "fs_g_status" for more detail

  TRUE otherwise

Definition at line 1766 of file navigation.c.

References _MEM_TYPE_SLOW_, FALSE, fat_check_mount_select(), fat_entry_longname(), fat_entry_shortname(), fat_read_dir(), FS_ERR_ENTRY_BAD, fs_g_nav_fast, fs_g_status, FS_NAME_GET, FS_NO_LAST_LFN_ENTRY, FS_SIZE_LFN_ENTRY, g_b_string_length, Is_unicode, TRUE, and Fs_management_fast::u16_entry_pos_sel_file.

    01767 {
    01768    _MEM_TYPE_SLOW_   U16 u16_lgt;   // Only used if LENGTH string mode enabled
    01769    U16  u16_ptr_save_entry;
    01770    Bool  b_readshortname = FALSE;
    01771
    01772    if ( !fat_check_mount_select())
    01773       return FALSE;
    01774
    01775    // Check if the string size is not 0
    01776    if( (FS_NAME_GET == b_mode)
    01777    &&  (0 == u8_size_max) )
    01778    {
    01779       return TRUE;
    01780    }
    01781
    01782    // Save the current entry position
    01783    u16_ptr_save_entry = fs_g_nav_fast.u16_entry_pos_sel_file;
    01784    // if it is the beginning of the directory
    01785    if ( 0 == fs_g_nav_fast.u16_entry_pos_sel_file )
    01786    {
    01787       b_readshortname = TRUE;                   // It isn't possibled to have a long name
    01788    }
    01789    else
    01790    {
    01791       fs_g_nav_fast.u16_entry_pos_sel_file--;   // Initialize entry position to search the first long name entry
    01792    }
    01793
    01794    // Loop in directory entry
    01795    u16_lgt = 0;
    01796    while( 1 )
    01797    {
    01798       if ( !fat_read_dir())
    01799          break; // error
    01800
    01801       if ( b_readshortname )
    01802       {
    01803          // No long name present then read short name
    01804          return fat_entry_shortname( sz_name , u8_size_max , b_mode  );
    01805       }
    01806
    01807       // Check or read the part of long file name in this entry
    01808       if ( fat_entry_longname( sz_name , u8_size_max , b_mode , b_match_case  ))
    01809       {
    01810          if( g_b_string_length )
    01811          {
    01812             ((FS_STR_UNICODE)sz_name )[0] += u16_lgt;
    01813          }
    01814          fs_g_nav_fast.u16_entry_pos_sel_file = u16_ptr_save_entry;
    01815          return TRUE;
    01816       }
    01817
    01818       if ( FS_NO_LAST_LFN_ENTRY != fs_g_status )
    01819       {
    01820          // Go to the main entry file (=short name entry)
    01821          fs_g_nav_fast.u16_entry_pos_sel_file = u16_ptr_save_entry;
    01822
    01823          if ( FS_ERR_ENTRY_BAD == fs_g_status )
    01824          {
    01825             // It isn't a long name entry then there aren't long file name
    01826             b_readshortname = TRUE;   // It is mandatory to use the short name
    01827             continue;                 // restart the loop
    01828          }
    01829          // here, it is a error system or the string don't match with the file name
    01830          break;
    01831       }
    01832       if( g_b_string_length )
    01833       {
    01834          u16_lgt += FS_SIZE_LFN_ENTRY;
    01835       }
    01836       else
    01837       {
    01838          // Increment the string to store the next part of file name
    01839          sz_name += FS_SIZE_LFN_ENTRY * (Is_unicode? 2 : 1 );
    01840          u8_size_max -= FS_SIZE_LFN_ENTRY;
    01841       }
    01842       fs_g_nav_fast.u16_entry_pos_sel_file--;   // Go to the next part of long file name
    01843
    01844    }  // end of loop while(1)
    01845    return FALSE;
    01846 }

Here is the call graph for this function:

U32 nav_file_lgt | ( | void |  | ) |

This function returns the size of selected file (unit byte).

Returns:
  Size of selected file (unit byte)

Definition at line 1853 of file navigation.c.

References fs_g_nav_entry, and Fs_management_entry::u32_size.

    01854 {
    01855    return fs_g_nav_entry.u32_size;
    01856 }

U16 nav_file_lgtsector | ( | void |  | ) |

This function returns the size of selected file (unit sector).

Returns:
  Size of selected file (unit 512B)

Definition at line 1863 of file navigation.c.

References FS_512B_SHIFT_BIT, fs_g_nav_entry, and Fs_management_entry::u32_size.

    01864 {
    01865    return (fs_g_nav_entry.u32_size >> FS_512B_SHIFT_BIT);
    01866 }

Bool nav_file_isreadonly | ( | void |  | ) |

This function checks the write protection of disk and the attribut "read only" of selected file.

Returns:
  FALSE, it is possible to modify the selected file

  TRUE, in other case

Definition at line 1874 of file navigation.c.

References fat_check_mount_select(), FS_ATTR_READ_ONLY, fs_g_nav, fs_g_nav_entry, mem_wr_protect(), TRUE, Fs_management_entry::u8_attr, and Fs_management::u8_lun.

    01875 {
    01876    if( !fat_check_mount_select() )
    01877       return TRUE;   // No file selected
    01878    if( mem_wr_protect( fs_g_nav.u8_lun ) )
    01879       return TRUE;   // Disk protected
    01880    return (0!=(FS_ATTR_READ_ONLY & fs_g_nav_entry.u8_attr));   // Check attribut "read only"
    01881 }

Here is the call graph for this function:

Bool nav_file_isdir | ( | void |  | ) |

This function returns the type of selected file.

Returns:
  TRUE, it is a directory

  FALSE, in other case

Definition at line 1889 of file navigation.c.

References fat_entry_is_dir().

    01890 {
    01891    return fat_entry_is_dir();
    01892 }

Here is the call graph for this function:

Bool nav_file_checkext | ( | const FS_STRING | sz_filterext | ) |

This function checks the extension of selected file.

Parameters:

  | sz_filterext | extension filter (ASCII format, e.g.: "txt" or "txt,d*,wk" )

Returns:
  TRUE, the file extension match with extension filter

  FALSE, in other case

Definition at line 1902 of file navigation.c.

References FALSE, fat_check_mount_select(), fat_entry_checkext(), fat_read_dir(), and TRUE.

    01903 {
    01904    if ( fat_check_mount_select() )
    01905    {
    01906       // Read selected entry (=short name entry) in directory
    01907       if ( fat_read_dir())
    01908       {
    01909          // Check the extension with filter
    01910          if ( fat_entry_checkext( (FS_STRING) sz_filterext ) )
    01911             return TRUE;
    01912       }
    01913    }
    01914    return FALSE;
    01915 }

Here is the call graph for this function:

Bool nav_file_dateget | ( | FS_STRING | sz_date,
|  | Bool | type_date |
| ) |  |  |

This function returns the date of selected file.

Parameters:

  | type_date | FS_DATE_LAST_WRITE, to get the date of last write access FS_DATE_CREATION, to get the date of file creation
  | sz_date | ASCCI string (>17B) to store the information about date "YYYYMMDDHHMMSSMS" = year, month, day, hour, minute, seconde, miliseconde

Returns:
  FALSE in case of error, see global value "fs_g_status" for more detail

  TRUE otherwise

Definition at line 1928 of file navigation.c.

References FALSE, fat_check_mount_select(), fat_get_date(), fat_read_dir(), and TRUE.

    01929 {
    01930    if ( !fat_check_mount_select())
    01931       return FALSE;
    01932
    01933    // Read selected entry in directory
    01934    if ( !fat_read_dir())
    01935       return FALSE;
    01936    fat_get_date( sz_date , type_date );
    01937    return TRUE;
    01938 }

Here is the call graph for this function:

U8 nav_file_attributget | ( | void |  | ) |

This function returns the attribut of selected file.

Returns:
  attribut of selected file, see masks "FS_ATTR_" in fs_com.h file.

Definition at line 1945 of file navigation.c.

References fs_g_nav_entry, and Fs_management_entry::u8_attr.

    01946 {
    01947    return fs_g_nav_entry.u8_attr;
    01948 }

Bool nav_file_dateset | ( | const FS_STRING | sz_date,
|  | Bool | type_date |
| ) |  |  |

This function changes the date of selected file.

Parameters:

  | type_date | FS_DATE_LAST_WRITE, to get the date of last write access FS_DATE_CREATION, to get the date of file creation
  | sz_date | ASCCI string contains the date to write "YYYYMMDDHHMMSSMS" = year, month, day, hour, minute, seconde, miliseconde

Returns:
  FALSE in case of error, see global value "fs_g_status" for more detail

  TRUE otherwise

Bool nav_file_attributset | ( | U8 | u8_attribut | ) |

This function changes the attribut of selected file.

Parameters:

  | u8_attribut | value to write on selected file, see masks "FS_ATTR_" in fs_com.h file.

Returns:
  FALSE in case of error, see global value "fs_g_status" for more detail

  TRUE otherwise

Bool nav_file_del | ( | Bool | b_only_empty | ) |

This function deletes the selected file or directory.

Parameters:

  | b_only_empty | TRUE, delete the directory only if empty FALSE, delete directories and files include in selected directory If the selection is not a directory then this param is ignored.

Returns:
  FALSE in case of error, see global value "fs_g_status" for more detail

  TRUE otherwise

Referenced by copy_dir(), ushell_cmd_perform(), ushell_cmd_perform_alloc(), ushell_cmd_rm(), and ushell_cmd_sync().

Here is the caller graph for this function:

Bool nav_file_rename | ( | const FS_STRING | sz_name | ) |

This function renames the selected directory or file.

Parameters:

  | sz_name | new name (ASCII or UNICODE )

Returns:
  FALSE in case of error, see global value "fs_g_status" for more detail

  TRUE otherwise

Referenced by ushell_cmd_rename().

Here is the caller graph for this function:

Bool nav_file_create | ( | const FS_STRING | sz_name | ) |

This function creates a file with NULL size and NULL attribut.

Parameters:

  | sz_name | file name to create (ASCII or UNICODE )

Returns:
  FALSE in case of error, see global value "fs_g_status" for more detail

  TRUE otherwise

    //! If you ues this routine to create a file, then you must called file_open() to open this new file
    //!

Referenced by firm_upgrade_status(), nav_setcwd(), ushell_cmd_perform_alloc(), and ushell_cmd_touch().

Here is the caller graph for this function:

Bool nav_file_copy | ( | void |  | ) |

This function updates the COPY navigator with the selected file.

Returns:
  FALSE in case of error, see global value "fs_g_status" for more detail

  TRUE otherwise

    //! If you use the COPY navigator after this routine then the copy information is lost (see FS_NAV_ID_COPYFILE in conf_explorer.h).
    //!

Referenced by copy_dir(), ushell_cmd_copy(), and ushell_cmd_sync().

Here is the caller graph for this function:

Bool nav_file_paste_start | ( | const FS_STRING | sz_name | ) |

This function pastes the selected file in COPY navigator in the file list of the current navigator.

Parameters:

  | sz_name | file name of the new file (ASCII or UNICODE )

Returns:
  FALSE in case of error, see global value "fs_g_status" for more detail

  TRUE otherwise

    //! After this routine, you shall called nav_file_paste_state() to run and way the copy
    //!

Referenced by copy_dir(), ushell_cmd_copy(), and ushell_cmd_sync().

Here is the caller graph for this function:

U8 nav_file_paste_state | ( | Bool | b_stop | ) |

This function executes the copy file.

Parameters:

  | b_stop | set TRUE to stop copy action

Returns:
  copy status
  COPY_BUSY, copy running COPY_FAIL, copy fail COPY_FINISH, copy finish

Referenced by copy_dir(), ushell_cmd_copy(), and ushell_cmd_sync().

Here is the caller graph for this function: