#include "fs_com.h"
Go to the source code of this file.
Data Structures | |
| union | Fs_rootdir |
| Union to define a root directory. More... | |
| struct | Fs_management |
| Struture to save the variables frequently used by file system mounted. More... | |
| struct | Fs_management_fast |
| Struture to save the variables very frequently used by file system mounted. More... | |
| struct | Fs_management_entry |
| Struture to save the frequently variables of file system mounted. More... | |
| struct | Fs_segment |
| Struture to define a segment. More... | |
| struct | Fs_cluster |
| Struture to store cluster information. More... | |
| struct | Fs_clusterlist_cache |
| Struture to store the cluster list cache. More... | |
| struct | Fs_sector_cache |
| Struture to store the information about sector cache (=last sector read or write on disk). More... | |
Variables used to manage the sector cache | |
| _MEM_TYPE_SLOW_ U8 | fs_g_sector [512] |
| _MEM_TYPE_SLOW_ Fs_sector_cache | fs_g_sectorcache |
| _MEM_TYPE_SLOW_ U32 | fs_gu32_addrsector |
| Store the address of futur cache (unit 512B). | |
| typedef U8 _MEM_TYPE_SLOW_ * | PTR_CACHE |
Defines | |
| #define | _GLOBEXT_ extern |
- File system vocabulary :
MBR : Master Boot Record (constains four PE)
PE : Partition Entry (constains a location informations about PBR)
PBR : Partition Boot Record
BPB : BIOS Parameter Block (see Hardware White Paper FAT)
PBR = BPB
FAT : File Allocation Table
| |
| #define | Is_fat12 (FS_TYPE_FAT_12 == fs_g_nav_fast.u8_type_fat) |
| #define | Is_fat16 (FS_TYPE_FAT_16 == fs_g_nav_fast.u8_type_fat) |
| #define | Is_fat32 (FS_TYPE_FAT_32 == fs_g_nav_fast.u8_type_fat) |
| #define | Is_unicode (g_b_unicode) |
| #define | FS_MBR_OFFSET_PART_ENTRY(num) ((U16)((U16)(0x1BE)+(0x10 * num))) |
| Position (unit byte) in the MBR of a partition entry. | |
| #define | FS_BUF_SECTOR_EMPTY 0xFF |
| Signal that sector cache is not valid. | |
Macro to access at fields in BPB sector (only used in fat_mount() function) | |
The name prefixed by "BPB_" are defined in "Hardware White Paper FAT" | |
| #define | LOW_16_BPB_BytsPerSec fs_g_sector[11] |
| #define | HIGH_16_BPB_BytsPerSec fs_g_sector[12] |
| #define | U8_BPB_SecPerClus fs_g_sector[13] |
| #define | LOW_16_BPB_RootEntCnt fs_g_sector[17] |
| #define | HIGH_16_BPB_RootEntCnt fs_g_sector[18] |
| #define | LOW_16_BPB_FATSz16 fs_g_sector[22] |
| #define | HIGH_16_BPB_FATSz16 fs_g_sector[23] |
| #define | LOW0_32_BPB_FATSz32 fs_g_sector[36] |
| #define | LOW1_32_BPB_FATSz32 fs_g_sector[37] |
| #define | LOW2_32_BPB_FATSz32 fs_g_sector[38] |
| #define | LOW3_32_BPB_FATSz32 fs_g_sector[39] |
| #define | LOW_16_BPB_TotSec16 fs_g_sector[19] |
| #define | HIGH_16_BPB_TotSec16 fs_g_sector[20] |
| #define | LOW0_32_BPB_TotSec32 fs_g_sector[32] |
| #define | LOW1_32_BPB_TotSec32 fs_g_sector[33] |
| #define | LOW2_32_BPB_TotSec32 fs_g_sector[34] |
| #define | LOW3_32_BPB_TotSec32 fs_g_sector[35] |
| #define | LOW_16_BPB_ResvSecCnt fs_g_sector[14] |
| #define | HIGH_16_BPB_ResvSecCnt fs_g_sector[15] |
| #define | U8_BPB_NumFATs fs_g_sector[16] |
| #define | LOW0_32_BPB_RootClus fs_g_sector[44] |
| #define | LOW1_32_BPB_RootClus fs_g_sector[45] |
| #define | LOW2_32_BPB_RootClus fs_g_sector[46] |
| #define | LOW3_32_BPB_RootClus fs_g_sector[47] |
| #define | LOW_16_BPB_FSInfo fs_g_sector[48] |
| #define | HIGH_16_BPB_FSInfo fs_g_sector[49] |
Constante used to sign a MBR or PBR sectors | |
| #define | FS_BR_SIGNATURE_LOW 0x55 |
| #define | FS_BR_SIGNATURE_HIGH 0xAA |
Constants used in MBR sector | |
| #define | FS_PART_BOOTABLE 0x80 |
| #define | FS_PART_NO_BOOTABLE 0x00 |
| #define | FS_PART_TYPE_FAT12 0x01 |
| #define | FS_PART_TYPE_FAT16_INF32M 0x04 |
| #define | FS_PART_TYPE_FAT16_SUP32M 0x06 |
| #define | FS_PART_TYPE_FAT16_SUP32M_BIS 0x0E |
| #define | FS_PART_TYPE_FAT32 0x0B |
| #define | FS_PART_TYPE_FAT32_BIS 0x0C |
| #define | FS_PART_REMOVE_MEDIA 0xF0 |
| #define | FS_PART_NO_REMOVE_MEDIA 0xF8 |
| #define | FS_PART_HARD_DISK 0x81 |
| #define | FS_BOOT_SIGN 0x29 |
Maximum of FAT cluster | |
| #define | FS_FAT12_MAX_CLUSTERS 4085 |
| #define | FS_FAT16_MAX_CLUSTERS 65525 |
Constants used in the first byte of file entry | |
| #define | FS_ENTRY_END 0x00 |
| #define | FS_ENTRY_DEL 0xE5 |
| #define | FS_ENTRY_LFN_LAST 0x40 |
Constantes used to manage the file entry | |
| #define | FS_SIZE_FILE_ENTRY 32 |
| #define | FS_SHIFT_B_TO_FILE_ENTRY 5 |
| #define | FS_SIZE_LFN_ENTRY 13 |
| #define | FS_SIZE_SFNAME 11 |
| #define | FS_SIZE_SFNAME_WITHOUT_EXT 8 |
| #define | FS_SIZE_SFNAME_EXT_ONLY 3 |
LIMITATIONS OF FILE SYSTEM | |
| #define | FS_NB_FAT 2 |
The unit sector of 512B is many used in file System stack | |
| #define | FS_512B 512 |
| #define | FS_512B_MASK (512-1) |
| #define | FS_512B_SHIFT_BIT 9 |
| #define | FS_SIZE_OF_SECTOR FS_512B |
| #define | FS_MASK_SIZE_OF_SECTOR FS_512B_MASK |
| #define | FS_SHIFT_B_TO_SECTOR FS_512B_SHIFT_BIT |
| #define | FS_CACHE_SIZE 512 |
Status of the fat_checkcluster() function | |
| #define | FS_CLUS_OK 0 |
| #define | FS_CLUS_BAD 1 |
| #define | FS_CLUS_END 2 |
Options of the fat_cluster_list() function | |
| #define | FS_CLUST_ACT_SEG 0x01 |
| #define | FS_CLUST_ACT_ONE 0x02 |
| #define | FS_CLUST_ACT_CLR 0x03 |
Options of the fat_cluster_val() function | |
| #define | FS_CLUST_VAL_READ FALSE |
| #define | FS_CLUST_VAL_WRITE TRUE |
| #define | FS_CLUST_VAL_EOL 0x0FFFFFFF |
FAT type ID, used in "Fs_management_fast.u8_type_fat" | |
| #define | FS_TYPE_FAT_UNM 0 |
| Partition not mounted. | |
| #define | FS_TYPE_FAT_12 1 |
| #define | FS_TYPE_FAT_16 2 |
| #define | FS_TYPE_FAT_32 3 |
Value used in "Fs_management_fast.u16_entry_pos_sel_file" | |
| #define | FS_NO_SEL 0xFFFF |
| Signal that a file entry isn't selected. | |
| #define | FS_END_FIND 0xFFFE |
| Signal that a file entry is the last file entry accessibled by system. | |
Macro to check the file open mode | |
| #define | Fat_file_is_open() (fs_g_nav_entry.u8_open_mode !=0 ) |
| #define | Fat_file_isnot_open() (fs_g_nav_entry.u8_open_mode ==0 ) |
| #define | Fat_file_close() (fs_g_nav_entry.u8_open_mode =0 ) |
Functions to control access disk | |
| #define | fat_check_nav_access_disk(b) (TRUE) |
| #define | fat_check_nav_access_file(b) (TRUE) |
Functions to manage navigator switch | |
| #define | fat_invert_nav ( arg ) (arg++) |
| #define | fat_copy_nav ( arg ) (arg++) |
Functions | |
| U8 | fat_get_nbpartition (void) |
| This function returns the number of partition present on selected drive. | |
| Bool | fat_mount (void) |
| This function mounts a partition. | |
| Bool | fat_format (U8 u8_fat_type) |
| This function formats the drive. | |
| Bool | fat_serialnumber (Bool b_action, U8 _MEM_TYPE_SLOW_ *a_u8_sn) |
| This function reads or writes a serial number. | |
Functions to verify navigator state | |
}@ | |
| Bool | fat_check_device (void) |
| Bool | fat_check_mount (void) |
| Bool | fat_check_noopen (void) |
| Bool | fat_check_open (void) |
| Bool | fat_check_select (void) |
| Bool | fat_check_mount_noopen (void) |
| Bool | fat_check_mount_select_noopen (void) |
| Bool | fat_check_mount_select_open (void) |
| Bool | fat_check_mount_select (void) |
| Bool | fat_check_is_file (void) |
Functions to compute free space on a partition | |
| U32 | fat_getfreespace (void) |
| U8 | fat_getfreespace_percent (void) |
| Bool | fat_write_fat32_FSInfo (U32 u32_nb_free_cluster) |
| U32 | fat_read_fat32_FSInfo (void) |
Functions to manage the cluster list | |
| Bool | fat_cluster_list (U8 opt_action, Bool b_for_file) |
| void | fat_cache_clusterlist_reset (void) |
| Bool | fat_cluster_val (Bool b_mode) |
| Bool | fat_cluster_readnext (void) |
| U8 | fat_checkcluster (void) |
| Bool | fat_allocfreespace (void) |
| void | fat_clear_info_fat_mod (void) |
| Bool | fat_clear_cluster (void) |
| Bool | fat_update_fat2 (void) |
Functions to read or to write a file or a directory | |
| Bool | fat_read_file (U8 mode) |
| Bool | fat_write_file (U8 mode, U32 u32_nb_sector_write) |
| Bool | fat_read_dir (void) |
| Bool | fat_initialize_dir (void) |
Functions to manage the entry field (fat.c) | |
| Bool | fat_entry_check (Bool b_type) |
| Bool | fat_entry_checkext (FS_STRING sz_filter) |
| void | fat_get_entry_info (void) |
| Bool | fat_entry_is_dir (void) |
| void | fat_clear_entry_info_and_ptr (void) |
| void | fat_write_entry_file (void) |
| Bool | fat_entry_shortname (FS_STRING sz_name, U8 u8_size_max, Bool b_mode) |
| Bool | fat_entry_longname (FS_STRING sz_name, U8 u8_size_max, Bool b_mode, Bool b_match_case) |
| Bool | fat_check_eof_name (U16 character) |
| PTR_CACHE | fat_get_ptr_entry (void) |
Functions to manage the entry field (fat_unusual.c) | |
| Bool | fat_create_entry_file_name (FS_STRING sz_name) |
| void | fat_get_date (FS_STRING sz_date, Bool type_date) |
| void | fat_set_date (const FS_STRING sz_date, Bool type_date) |
| Bool | fat_delete_file (Bool b_cluster_list) |
| Bool | fat_entry_label (Bool b_action, FS_STRING sz_label) |
Functions to manage the cache | |
| Bool | fat_cache_read_sector (Bool b_load) |
| void | fat_cache_reset (void) |
| void | fat_cache_clear (void) |
| void | fat_cache_mark_sector_as_dirty (void) |
| Bool | fat_cache_flush (void) |
Variables | |
| Bool | g_b_unicode |
| Variables to select string format (initialised in nav_reset()). | |
| Bool | g_b_string_length |
| Variables to select LENGTH string mode (initialised in nav_reset()). | |
| Bool | g_b_no_check_disk |
| Variables to enable/disable the disk check before each action on disk. | |
| _MEM_TYPE_FAST_ Fs_segment | fs_g_seg |
| Variable frequently used by many function (optimization, no parameter in function). | |
| _MEM_TYPE_FAST_ Fs_cluster | fs_g_cluster |
| To take time in functions: fat_getfreespace, fat_cluster_list, fat_cluster_val, fat_checkcluster. | |
Variables initialised in drive_mount() | |
| _MEM_TYPE_SLOW_ Fs_management | fs_g_nav |
| _MEM_TYPE_FAST_ Fs_management_fast | fs_g_nav_fast |
| _MEM_TYPE_SLOW_ Fs_management_entry | fs_g_nav_entry |
This file is the header for FAT services
Definition in file fat.h.
| #define _GLOBEXT_ extern |
| #define Is_unicode (g_b_unicode) |
| #define LOW_16_BPB_BytsPerSec fs_g_sector[11] |
| #define HIGH_16_BPB_BytsPerSec fs_g_sector[12] |
| #define U8_BPB_SecPerClus fs_g_sector[13] |
| #define LOW_16_BPB_RootEntCnt fs_g_sector[17] |
| #define HIGH_16_BPB_RootEntCnt fs_g_sector[18] |
| #define LOW_16_BPB_FATSz16 fs_g_sector[22] |
| #define HIGH_16_BPB_FATSz16 fs_g_sector[23] |
| #define LOW0_32_BPB_FATSz32 fs_g_sector[36] |
| #define LOW1_32_BPB_FATSz32 fs_g_sector[37] |
| #define LOW2_32_BPB_FATSz32 fs_g_sector[38] |
| #define LOW3_32_BPB_FATSz32 fs_g_sector[39] |
| #define LOW_16_BPB_TotSec16 fs_g_sector[19] |
| #define HIGH_16_BPB_TotSec16 fs_g_sector[20] |
| #define LOW0_32_BPB_TotSec32 fs_g_sector[32] |
| #define LOW1_32_BPB_TotSec32 fs_g_sector[33] |
| #define LOW2_32_BPB_TotSec32 fs_g_sector[34] |
| #define LOW3_32_BPB_TotSec32 fs_g_sector[35] |
| #define LOW_16_BPB_ResvSecCnt fs_g_sector[14] |
| #define HIGH_16_BPB_ResvSecCnt fs_g_sector[15] |
| #define U8_BPB_NumFATs fs_g_sector[16] |
| #define LOW0_32_BPB_RootClus fs_g_sector[44] |
| #define LOW1_32_BPB_RootClus fs_g_sector[45] |
| #define LOW2_32_BPB_RootClus fs_g_sector[46] |
| #define LOW3_32_BPB_RootClus fs_g_sector[47] |
| #define LOW_16_BPB_FSInfo fs_g_sector[48] |
| #define HIGH_16_BPB_FSInfo fs_g_sector[49] |
| #define FS_BUF_SECTOR_EMPTY 0xFF |
| #define FS_NO_SEL 0xFFFF |
| #define FS_END_FIND 0xFFFE |
| #define Fat_file_is_open | ( | ) | (fs_g_nav_entry.u8_open_mode !=0 ) |
| #define Fat_file_isnot_open | ( | ) | (fs_g_nav_entry.u8_open_mode ==0 ) |
| Bool fat_check_device | ( | void | ) |
| Bool fat_check_mount | ( | void | ) |
| Bool fat_check_noopen | ( | void | ) |
| Bool fat_check_open | ( | void | ) |
| Bool fat_check_select | ( | void | ) |
| Bool fat_check_mount_noopen | ( | void | ) |
| Bool fat_check_mount_select_noopen | ( | void | ) |
| Bool fat_check_mount_select_open | ( | void | ) |
| Bool fat_check_mount_select | ( | void | ) |
| Bool fat_check_is_file | ( | void | ) |
| U8 fat_get_nbpartition | ( | void | ) |
This function returns the number of partition present on selected drive.
| Bool fat_mount | ( | void | ) |
This function mounts a partition.
This function reads or writes a serial number.
| U32 fat_getfreespace | ( | void | ) |
| U8 fat_getfreespace_percent | ( | void | ) |
| U32 fat_read_fat32_FSInfo | ( | void | ) |
| void fat_cache_clusterlist_reset | ( | void | ) |
| Bool fat_cluster_readnext | ( | void | ) |
| U8 fat_checkcluster | ( | void | ) |
| Bool fat_allocfreespace | ( | void | ) |
| void fat_clear_info_fat_mod | ( | void | ) |
| Bool fat_clear_cluster | ( | void | ) |
| Bool fat_update_fat2 | ( | void | ) |
| Bool fat_read_dir | ( | void | ) |
| Bool fat_initialize_dir | ( | void | ) |
| void fat_get_entry_info | ( | void | ) |
| Bool fat_entry_is_dir | ( | void | ) |
| void fat_clear_entry_info_and_ptr | ( | void | ) |
| void fat_write_entry_file | ( | void | ) |
| PTR_CACHE fat_get_ptr_entry | ( | void | ) |
| void fat_cache_reset | ( | void | ) |
| void fat_cache_clear | ( | void | ) |
| void fat_cache_mark_sector_as_dirty | ( | void | ) |
| Bool fat_cache_flush | ( | void | ) |
Variables to select string format (initialised in nav_reset()).
Variables to select LENGTH string mode (initialised in nav_reset()).
Variables to enable/disable the disk check before each action on disk.
| _MEM_TYPE_SLOW_ Fs_management fs_g_nav |
| _MEM_TYPE_FAST_ Fs_management_fast fs_g_nav_fast |
| _MEM_TYPE_SLOW_ Fs_management_entry fs_g_nav_entry |
| _MEM_TYPE_FAST_ Fs_segment fs_g_seg |
Variable frequently used by many function (optimization, no parameter in function).
| _MEM_TYPE_FAST_ Fs_cluster fs_g_cluster |
To take time in functions: fat_getfreespace, fat_cluster_list, fat_cluster_val, fat_checkcluster.
| _MEM_TYPE_SLOW_ U8 fs_g_sector[512] |
Referenced by stream_mem_to_mem().
| _MEM_TYPE_SLOW_ Fs_sector_cache fs_g_sectorcache |
| _MEM_TYPE_SLOW_ U32 fs_gu32_addrsector |
Store the address of futur cache (unit 512B).
1.5.3