UbixOS  2.0
fat_access.h File Reference
#include "fat_defs.h"
#include "fat_opts.h"
Include dependency graph for fat_access.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  disk_if
 
struct  fat_buffer
 
struct  fatfs
 
struct  fs_dir_ent
 
struct  fs_dir_list_status
 

Macros

#define FAT_DIR_ENTRIES_PER_SECTOR   (FAT_SECTOR_SIZE / FAT_DIR_ENTRY_SIZE)
 
#define FAT_INIT_ENDIAN_ERROR   (-4)
 
#define FAT_INIT_INVALID_SECTOR_SIZE   (-2)
 
#define FAT_INIT_INVALID_SIGNATURE   (-3)
 
#define FAT_INIT_MEDIA_ACCESS_ERROR   (-1)
 
#define FAT_INIT_OK   0
 
#define FAT_INIT_STRUCT_PACKING   (-7)
 
#define FAT_INIT_WRONG_FILESYS_TYPE   (-5)
 
#define FAT_INIT_WRONG_PARTITION_TYPE   (-6)
 

Typedefs

typedef int(* fn_diskio_read) (uint32 sector, uint8 *buffer, uint32 sector_count)
 
typedef int(* fn_diskio_write) (uint32 sector, uint8 *buffer, uint32 sector_count)
 
typedef enum eFatType tFatType
 

Enumerations

enum  eFatType { FAT_TYPE_16, FAT_TYPE_32 }
 

Functions

uint32 fatfs_get_file_entry (struct fatfs *fs, uint32 Cluster, char *nametofind, struct fat_dir_entry *sfEntry)
 
uint32 fatfs_get_root_cluster (struct fatfs *fs)
 
int fatfs_init (struct fatfs *fs)
 
uint32 fatfs_lba_of_cluster (struct fatfs *fs, uint32 Cluster_Number)
 
int fatfs_list_directory_next (struct fatfs *fs, struct fs_dir_list_status *dirls, struct fs_dir_ent *entry)
 
void fatfs_list_directory_start (struct fatfs *fs, struct fs_dir_list_status *dirls, uint32 StartCluster)
 
int fatfs_mark_file_deleted (struct fatfs *fs, uint32 Cluster, char *shortname)
 
int fatfs_read_sector (struct fatfs *fs, uint32 cluster, uint32 sector, uint8 *target)
 
int fatfs_sector_read (struct fatfs *fs, uint32 lba, uint8 *target, uint32 count)
 
int fatfs_sector_reader (struct fatfs *fs, uint32 Startcluster, uint32 offset, uint8 *target)
 
int fatfs_sector_write (struct fatfs *fs, uint32 lba, uint8 *target, uint32 count)
 
int fatfs_sfn_exists (struct fatfs *fs, uint32 Cluster, char *shortname)
 
void fatfs_show_details (struct fatfs *fs)
 
int fatfs_update_file_length (struct fatfs *fs, uint32 Cluster, char *shortname, uint32 fileLength)
 
int fatfs_update_timestamps (struct fat_dir_entry *directoryEntry, int create, int modify, int access)
 
int fatfs_write_sector (struct fatfs *fs, uint32 cluster, uint32 sector, uint8 *target)
 

Macro Definition Documentation

◆ FAT_DIR_ENTRIES_PER_SECTOR

#define FAT_DIR_ENTRIES_PER_SECTOR   (FAT_SECTOR_SIZE / FAT_DIR_ENTRY_SIZE)

Definition at line 19 of file fat_access.h.

◆ FAT_INIT_ENDIAN_ERROR

#define FAT_INIT_ENDIAN_ERROR   (-4)

Definition at line 14 of file fat_access.h.

◆ FAT_INIT_INVALID_SECTOR_SIZE

#define FAT_INIT_INVALID_SECTOR_SIZE   (-2)

Definition at line 12 of file fat_access.h.

◆ FAT_INIT_INVALID_SIGNATURE

#define FAT_INIT_INVALID_SIGNATURE   (-3)

Definition at line 13 of file fat_access.h.

◆ FAT_INIT_MEDIA_ACCESS_ERROR

#define FAT_INIT_MEDIA_ACCESS_ERROR   (-1)

Definition at line 11 of file fat_access.h.

◆ FAT_INIT_OK

#define FAT_INIT_OK   0

Definition at line 10 of file fat_access.h.

◆ FAT_INIT_STRUCT_PACKING

#define FAT_INIT_STRUCT_PACKING   (-7)

Definition at line 17 of file fat_access.h.

◆ FAT_INIT_WRONG_FILESYS_TYPE

#define FAT_INIT_WRONG_FILESYS_TYPE   (-5)

Definition at line 15 of file fat_access.h.

◆ FAT_INIT_WRONG_PARTITION_TYPE

#define FAT_INIT_WRONG_PARTITION_TYPE   (-6)

Definition at line 16 of file fat_access.h.

Typedef Documentation

◆ fn_diskio_read

typedef int(* fn_diskio_read) (uint32 sector, uint8 *buffer, uint32 sector_count)

Definition at line 24 of file fat_access.h.

◆ fn_diskio_write

typedef int(* fn_diskio_write) (uint32 sector, uint8 *buffer, uint32 sector_count)

Definition at line 25 of file fat_access.h.

◆ tFatType

typedef enum eFatType tFatType

Enumeration Type Documentation

◆ eFatType

enum eFatType
Enumerator
FAT_TYPE_16 
FAT_TYPE_32 

Definition at line 51 of file fat_access.h.

Function Documentation

◆ fatfs_get_file_entry()

uint32 fatfs_get_file_entry ( struct fatfs fs,
uint32  Cluster,
char *  nametofind,
struct fat_dir_entry sfEntry 
)

◆ fatfs_get_root_cluster()

uint32 fatfs_get_root_cluster ( struct fatfs fs)

Definition at line 373 of file fat_access.c.

◆ fatfs_init()

◆ fatfs_lba_of_cluster()

uint32 fatfs_lba_of_cluster ( struct fatfs fs,
uint32  Cluster_Number 
)

Definition at line 191 of file fat_access.c.

References FAT_SECTOR_SIZE, and FAT_TYPE_16.

Referenced by fatfs_read_sector(), fatfs_sector_reader(), and fatfs_write_sector().

◆ fatfs_list_directory_next()

◆ fatfs_list_directory_start()

void fatfs_list_directory_start ( struct fatfs fs,
struct fs_dir_list_status dirls,
uint32  StartCluster 
)

◆ fatfs_mark_file_deleted()

int fatfs_mark_file_deleted ( struct fatfs fs,
uint32  Cluster,
char *  shortname 
)

◆ fatfs_read_sector()

int fatfs_read_sector ( struct fatfs fs,
uint32  cluster,
uint32  sector,
uint8 target 
)

Definition at line 263 of file fat_access.c.

References FAT_TYPE_16, and fatfs_lba_of_cluster().

Here is the call graph for this function:

◆ fatfs_sector_read()

int fatfs_sector_read ( struct fatfs fs,
uint32  lba,
uint8 target,
uint32  count 
)

Definition at line 200 of file fat_access.c.

◆ fatfs_sector_reader()

int fatfs_sector_reader ( struct fatfs fs,
uint32  Startcluster,
uint32  offset,
uint8 target 
)

◆ fatfs_sector_write()

int fatfs_sector_write ( struct fatfs fs,
uint32  lba,
uint8 target,
uint32  count 
)

Definition at line 206 of file fat_access.c.

◆ fatfs_sfn_exists()

int fatfs_sfn_exists ( struct fatfs fs,
uint32  Cluster,
char *  shortname 
)

◆ fatfs_show_details()

void fatfs_show_details ( struct fatfs fs)

Definition at line 362 of file fat_access.c.

References FAT_PRINTF, and FAT_TYPE_32.

◆ fatfs_update_file_length()

int fatfs_update_file_length ( struct fatfs fs,
uint32  Cluster,
char *  shortname,
uint32  fileLength 
)

◆ fatfs_update_timestamps()

int fatfs_update_timestamps ( struct fat_dir_entry directoryEntry,
int  create,
int  modify,
int  access 
)

◆ fatfs_write_sector()

int fatfs_write_sector ( struct fatfs fs,
uint32  cluster,
uint32  sector,
uint8 target 
)

Definition at line 311 of file fat_access.c.

References FAT_TYPE_16, and fatfs_lba_of_cluster().

Here is the call graph for this function: