UbixOS V2 2.0

Data Structures | Macros | Typedefs | Enumerations | Functions
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
| ) |  |

Definition at line 380 of file fat_access.c.

References FAT_DIR_ENTRIES_PER_SECTOR, FAT_DIR_ENTRY_SIZE, fatfs_compare_names(), fatfs_entry_lfn_exists(), fatfs_entry_lfn_invalid(), fatfs_entry_lfn_text(), fatfs_entry_sfn_only(), fatfs_lfn_cache_entry(), fatfs_lfn_cache_get(), fatfs_lfn_cache_init(), fatfs_sector_reader(), memcpy(), memset(), and NULL.

Here is the call graph for this function:

## ◆ fatfs_get_root_cluster()

uint32 fatfs_get_root_cluster | ( | struct fatfs * | fs | ) |

Definition at line 373 of file fat_access.c.

## ◆ fatfs_init()

int fatfs_init | ( | struct fatfs * | fs | ) |

Definition at line 43 of file fat_access.c.

References BPB_BYTSPERSEC, BPB_FAT32_FATSZ32, BPB_FAT32_FSINFO, BPB_FAT32_ROOTCLUS, BPB_FATSZ16, BPB_NUMFATS, BPB_ROOTENTCNT, BPB_RSVDSECCNT, BPB_SECPERCLUS, BPB_TOTSEC16, BPB_TOTSEC32, FAT32_INVALID_CLUSTER, FAT_DIR_ENTRY_SIZE, FAT_INIT_ENDIAN_ERROR, FAT_INIT_INVALID_SECTOR_SIZE, FAT_INIT_INVALID_SIGNATURE, FAT_INIT_MEDIA_ACCESS_ERROR, FAT_INIT_OK, FAT_INIT_STRUCT_PACKING, FAT_INIT_WRONG_FILESYS_TYPE, FAT_SECTOR_SIZE, FAT_TYPE_16, FAT_TYPE_32, fatfs_fat_init(), GET_16BIT_WORD, GET_32BIT_WORD, PARTITION1_LBA_BEGIN_LOCATION, PARTITION1_TYPECODE_LOCATION, SIGNATURE_POSITION, and SIGNATURE_VALUE.

Here is the call graph for this function:

## ◆ 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()

int fatfs_list_directory_next | ( | struct fatfs * | fs,
|  | struct fs_dir_list_status * | dirls,
|  | struct fs_dir_ent * | entry
| ) |  |

Definition at line 719 of file fat_access.c.

References fs_dir_list_status::cluster, fs_dir_ent::cluster, FAT_DIR_ENTRIES_PER_SECTOR, FAT_DIR_ENTRY_SIZE, FAT_HTONL, FAT_HTONS, fatfs_entry_is_dir(), fatfs_entry_lfn_exists(), fatfs_entry_lfn_invalid(), fatfs_entry_lfn_text(), fatfs_entry_sfn_only(), fatfs_get_sfn_display_name(), fatfs_lfn_cache_entry(), fatfs_lfn_cache_get(), fatfs_lfn_cache_init(), FATFS_MAX_LONG_FILENAME, fatfs_sector_reader(), fs_dir_ent::filename, fs_dir_ent::is_dir, memset(), NULL, fs_dir_list_status::offset, fs_dir_list_status::sector, fs_dir_ent::size, and strncpy().

Here is the call graph for this function:

## ◆ fatfs_list_directory_start()

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

Definition at line 708 of file fat_access.c.

References fs_dir_list_status::cluster, fs_dir_list_status::offset, and fs_dir_list_status::sector.

## ◆ fatfs_mark_file_deleted()

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

Definition at line 643 of file fat_access.c.

References FAT_DIR_ENTRIES_PER_SECTOR, FAT_DIR_ENTRY_SIZE, fatfs_entry_lfn_invalid(), fatfs_entry_lfn_text(), fatfs_entry_sfn_only(), fatfs_sector_reader(), fatfs_update_timestamps(), FILE_HEADER_DELETED, memcpy(), and strncmp().

Here is the call graph for this function:

## ◆ 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
| ) |  |

Definition at line 213 of file fat_access.c.

References FAT32_LAST_CLUSTER, FAT_TYPE_16, fatfs_find_next_cluster(), and fatfs_lba_of_cluster().

Referenced by fatfs_get_file_entry(), fatfs_list_directory_next(), fatfs_mark_file_deleted(), fatfs_sfn_exists(), and fatfs_update_file_length().

Here is the call graph for this function:

## ◆ 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
| ) |  |

Definition at line 478 of file fat_access.c.

References FAT_DIR_ENTRIES_PER_SECTOR, FAT_DIR_ENTRY_SIZE, fatfs_entry_lfn_invalid(), fatfs_entry_lfn_text(), fatfs_entry_sfn_only(), fatfs_sector_reader(), and strncmp().

Here is the call graph for this function:

## ◆ 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
| ) |  |

Definition at line 578 of file fat_access.c.

References FAT_DIR_ENTRIES_PER_SECTOR, FAT_DIR_ENTRY_SIZE, FAT_HTONL, fatfs_entry_lfn_invalid(), fatfs_entry_lfn_text(), fatfs_entry_sfn_only(), fatfs_sector_reader(), fatfs_update_timestamps(), memcpy(), and strncmp().

Here is the call graph for this function:

## ◆ fatfs_update_timestamps()

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

Referenced by fatfs_mark_file_deleted(), and fatfs_update_file_length().

## ◆ 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: