Microchip® Advanced Software Framework

fat.c File Reference
#include "conf_explorer.h"
#include "fs_com.h"
#include "fat.h"
#include <string.h>
#include "ctrl_access.h"

Macros

#define _fat_c_
 

Functions

void fat_cache_clear (void)
 This function clears the sector cache. More...
 
bool fat_cache_flush (void)
 This function flushes the sector cache on the memory if necessary. More...
 
void fat_cache_mark_sector_as_dirty (void)
 This function sets a flag to signal that sector cache is modified. More...
 
bool fat_cache_read_sector (bool b_load)
 This function loads a memory sector in internal cache sector. More...
 
void fat_cache_reset (void)
 This function resets the sector cache. More...
 
bool fat_check_device (void)
 This function checks device state. More...
 
bool fat_check_eof_name (uint16_t character)
 Check end of name. More...
 
bool fat_check_is_file (void)
 This function checks if the selected file entry is a file and not a directory. More...
 
bool fat_check_mount (void)
 This function checks if the partition is mounted. More...
 
bool fat_check_mount_noopen (void)
 This function checks if the partition is mounted and no file is opened. More...
 
bool fat_check_mount_select (void)
 This function checks if the partition is mounted and if a file is selected. More...
 
bool fat_check_mount_select_noopen (void)
 This function checks if the partition is mounted and if no file is opened and a file is selected. More...
 
bool fat_check_mount_select_open (void)
 This function checks if the partition is mounted and if a file is opened. More...
 
bool fat_check_nav_access_disk (void)
 This function checks write access. More...
 
bool fat_check_nav_access_file (bool mode)
 This function checks all access at current file. More...
 
bool fat_check_noopen (void)
 This function checks if a file is not opened on current navigator. More...
 
bool fat_check_open (void)
 This function checks if a file is opened on current navigator. More...
 
bool fat_check_select (void)
 This function checks if a file is selected on current navigator. More...
 
void fat_clear_entry_info_and_ptr (void)
 This function resets the selection pointers. More...
 
bool fat_cluster_list (uint8_t opt_action, bool b_for_file)
 This function gets or clears a cluster list. More...
 
void fat_copy_nav (uint8_t u8_idnav)
 This function copies the main navigator to another navigator. More...
 
bool fat_entry_check (bool b_type)
 This function checks the entry. More...
 
bool fat_entry_checkext (FS_STRING sz_filter)
 This function checks the file extension. More...
 
bool fat_entry_is_dir (void)
 This function checks if the entry file is a directory. More...
 
bool fat_entry_longname (FS_STRING sz_name, uint8_t u8_size_max, bool b_mode, bool b_match_case)
 This function returns or compares the long name entry. More...
 
bool fat_entry_shortname (FS_STRING sz_name, uint8_t u8_size_max, bool b_mode)
 This function returns or compares the short name entry. More...
 
void fat_get_entry_info (void)
 This function reads information about selected file. More...
 
PTR_CACHE fat_get_ptr_entry (void)
 This function returns a cache pointer on the current entry. More...
 
void fat_invert_nav (uint8_t u8_idnav)
 This function inverts the current navigation with another. More...
 
bool fat_read_dir (void)
 This function fill the internal cache with a sector from current directory. More...
 
bool fat_read_file (uint8_t mode)
 This function gets or clears a cluster list at the current position in the selected file. More...
 
void fat_write_entry_file (void)
 This function writes the information about selected file. More...
 
bool fat_write_file (uint8_t mode, uint32_t u32_nb_sector_write)
 This function gets and eventually allocs a cluster list at the current position in the selected file. More...
 
Internal functions to manage cluster list caches
void fat_cache_clusterlist_update_start (bool b_for_file)
 This function initializes a cache in cluster list caches. More...
 
void fat_cache_clusterlist_update_finish (void)
 This function updates a cache of cluster list caches. More...
 
bool fat_cache_clusterlist_update_read (bool b_for_file)
 This function searches a cluster list in cluster list caches. More...
 
void fat_cache_clusterlist_update_select (void)
 This function signals that a cache is used. More...
 
void fat_cache_clusterlist_reset (void)
 This function resets the cluster list caches. More...
 

Variables

Store navigator data no selected
_MEM_TYPE_SLOW_ Fs_management fs_g_navext [FS_NB_NAVIGATOR-1]
 
_MEM_TYPE_SLOW_ Fs_management_fast fs_g_navext_fast [FS_NB_NAVIGATOR-1]
 
_MEM_TYPE_SLOW_ Fs_management_entry fs_g_navext_entry [FS_NB_NAVIGATOR-1]
 
Variables to manage cluster list caches
_MEM_TYPE_SLOW_
Fs_clusterlist_cache 
fs_g_cache_clusterlist [FS_NB_CACHE_CLUSLIST *2]
 
_MEM_TYPE_SLOW_ uint8_t fs_g_u8_current_cache
 

Position of the current cluster in the FAT <br>

Global variable used to take time with routines fat_cluster_readnext() and fat_cluster_val()

_MEM_TYPE_FAST_ uint16_t fs_g_u16_pos_fat
 
bool fat_cluster_val (bool b_mode)
 This function returns or modifies a cluster value in FAT. More...
 
bool fat_cluster_readnext (void)
 This function is optimized to read a continue cluster list on FAT16 and FAT32. More...
 
uint8_t fat_checkcluster (void)
 This function checks the cluster value. More...
 

#define _fat_c_

bool fat_cache_clusterlist_update_read ( bool  b_for_file)

This function searches a cluster list in cluster list caches.

Parameters
b_for_fileIf true then it is a file cluster list else a directory cluster list
Returns
true cluster list found and global variable fs_g_seg updated
false no found in cluster list caches

References fat_cache_clusterlist_update_select(), fat_cache_clusterlist_update_start(), fs_g_cache_clusterlist, fs_g_cluster, fs_g_nav, fs_g_seg, fs_g_u8_current_cache, FS_NB_CACHE_CLUSLIST, Fs_segment::u32_addr, Fs_clusterlist_cache::u32_addr, Fs_management::u32_offset_data, st_fs_cluster::u32_pos, Fs_management::u32_ptr_fat, Fs_clusterlist_cache::u32_size, Fs_segment::u32_size_or_pos, Fs_clusterlist_cache::u32_start, Fs_management::u8_BPB_SecPerClus, Fs_management::u8_lun, and Fs_clusterlist_cache::u8_lun.

Referenced by fat_cluster_list().

void fat_cache_clusterlist_update_select ( void  )
void fat_cache_clusterlist_update_start ( bool  b_for_file)

_MEM_TYPE_FAST_ uint16_t fs_g_u16_pos_fat

Referenced by fat_cluster_val().