UbixOS V2 2.0

Data Structures | Macros | Functions
fat_misc.h File Reference
`#include "fat_defs.h"`
`#include "fat_opts.h"`
Include dependency graph for fat_misc.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Data Structures
struct | lfn_cache

## Macros
#define | GET_16BIT_WORD(buffer, location) ( ((uint16)buffer[location+1]<<8) + (uint16)buffer[location+0] )
#define | GET_32BIT_WORD(buffer, location) ( ((uint32)buffer[location+3]<<24) + ((uint32)buffer[location+2]<<16) + ((uint32)buffer[location+1]<<8) + (uint32)buffer[location+0] )
#define | MAX_LFN_ENTRY_LENGTH 13
#define | MAX_LONGFILENAME_ENTRIES 20
#define | SET_16BIT_WORD(buffer, location, value)
#define | SET_32BIT_WORD(buffer, location, value)

## Functions
void | fatfs_convert_from_fat_date (uint16 fat_date, int *day, int *month, int *year)
void | fatfs_convert_from_fat_time (uint16 fat_time, int *hours, int *minutes, int *seconds)
uint16 | fatfs_convert_to_fat_date (int day, int month, int year)
uint16 | fatfs_convert_to_fat_time (int hours, int minutes, int seconds)
int | fatfs_entry_is_dir (struct fat_dir_entry *entry)
int | fatfs_entry_is_file (struct fat_dir_entry *entry)
int | fatfs_entry_lfn_exists (struct lfn_cache *lfn, struct fat_dir_entry *entry)
int | fatfs_entry_lfn_invalid (struct fat_dir_entry *entry)
int | fatfs_entry_lfn_text (struct fat_dir_entry *entry)
int | fatfs_entry_sfn_only (struct fat_dir_entry *entry)
void | fatfs_filename_to_lfn (char *filename, uint8 *buffer, int entry, uint8 sfnChk)
void | fatfs_lfn_cache_entry (struct lfn_cache *lfn, uint8 *entryBuffer)
char * | fatfs_lfn_cache_get (struct lfn_cache *lfn)
void | fatfs_lfn_cache_init (struct lfn_cache *lfn, int wipeTable)
int | fatfs_lfn_create_sfn (char *sfn_output, char *filename)
int | fatfs_lfn_entries_required (char *filename)
int | fatfs_lfn_generate_tail (char *sfn_output, char *sfn_input, uint32 tailNum)
void | fatfs_print_sector (uint32 sector, uint8 *data)
void | fatfs_sfn_create_entry (char *shortfilename, uint32 size, uint32 startCluster, struct fat_dir_entry *entry, int dir)

## Macro Definition Documentation

## ◆ GET_16BIT_WORD

#define GET_16BIT_WORD | ( |  | buffer,
|  |  | location
| ) |  | ( ((uint16)buffer[location+1]<<8) + (uint16)buffer[location+0] )

Definition at line 17 of file fat_misc.h.

## ◆ GET_32BIT_WORD

#define GET_32BIT_WORD | ( |  | buffer,
|  |  | location
| ) |  | ( ((uint32)buffer[location+3]<<24) + ((uint32)buffer[location+2]<<16) + ((uint32)buffer[location+1]<<8) + (uint32)buffer[location+0] )

Definition at line 16 of file fat_misc.h.

## ◆ MAX_LFN_ENTRY_LENGTH

#define MAX_LFN_ENTRY_LENGTH 13

Definition at line 11 of file fat_misc.h.

## ◆ MAX_LONGFILENAME_ENTRIES

#define MAX_LONGFILENAME_ENTRIES 20

Definition at line 10 of file fat_misc.h.

## ◆ SET_16BIT_WORD

#define SET_16BIT_WORD | ( |  | buffer,
|  |  | location,
|  |  | value
| ) |  |

Value:
{ buffer[location+0] = (uint8)((value)&0xFF); \
buffer[location+1] = (uint8)((value>>8)&0xFF); }

Definition at line 24 of file fat_misc.h.

## ◆ SET_32BIT_WORD

#define SET_32BIT_WORD | ( |  | buffer,
|  |  | location,
|  |  | value
| ) |  |

Value:
{ buffer[location+0] = (uint8)((value)&0xFF); \
buffer[location+1] = (uint8)((value>>8)&0xFF); \
buffer[location+2] = (uint8)((value>>16)&0xFF); \
buffer[location+3] = (uint8)((value>>24)&0xFF); }

Definition at line 19 of file fat_misc.h.

## Function Documentation

## ◆ fatfs_convert_from_fat_date()

void fatfs_convert_from_fat_date | ( | uint16 | fat_date,
|  | int * | day,
|  | int * | month,
|  | int * | year
| ) |  |

## ◆ fatfs_convert_from_fat_time()

void fatfs_convert_from_fat_time | ( | uint16 | fat_time,
|  | int * | hours,
|  | int * | minutes,
|  | int * | seconds
| ) |  |

## ◆ fatfs_convert_to_fat_date()

uint16 fatfs_convert_to_fat_date | ( | int | day,
|  | int | month,
|  | int | year
| ) |  |

## ◆ fatfs_convert_to_fat_time()

uint16 fatfs_convert_to_fat_time | ( | int | hours,
|  | int | minutes,
|  | int | seconds
| ) |  |

## ◆ fatfs_entry_is_dir()

int fatfs_entry_is_dir | ( | struct fat_dir_entry * | entry | ) |

Definition at line 152 of file fat_misc.c.

References fat_dir_entry::Attr, and FILE_TYPE_DIR.

Referenced by fatfs_list_directory_next().

## ◆ fatfs_entry_is_file()

int fatfs_entry_is_file | ( | struct fat_dir_entry * | entry | ) |

Definition at line 161 of file fat_misc.c.

References fat_dir_entry::Attr, and FILE_TYPE_FILE.

## ◆ fatfs_entry_lfn_exists()

int fatfs_entry_lfn_exists | ( | struct lfn_cache * | lfn,
|  | struct fat_dir_entry * | entry
| ) |  |

Definition at line 132 of file fat_misc.c.

References fat_dir_entry::Attr, FILE_ATTR_LFN_TEXT, FILE_ATTR_SYSHID, FILE_ATTR_VOLUME_ID, FILE_HEADER_BLANK, FILE_HEADER_DELETED, fat_dir_entry::Name, and lfn_cache::no_of_strings.

Referenced by fatfs_get_file_entry(), and fatfs_list_directory_next().

## ◆ fatfs_entry_lfn_invalid()

int fatfs_entry_lfn_invalid | ( | struct fat_dir_entry * | entry | ) |

Definition at line 121 of file fat_misc.c.

References fat_dir_entry::Attr, FILE_ATTR_SYSHID, FILE_ATTR_VOLUME_ID, FILE_HEADER_BLANK, FILE_HEADER_DELETED, and fat_dir_entry::Name.

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

## ◆ fatfs_entry_lfn_text()

int fatfs_entry_lfn_text | ( | struct fat_dir_entry * | entry | ) |

Definition at line 110 of file fat_misc.c.

References fat_dir_entry::Attr, and FILE_ATTR_LFN_TEXT.

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

## ◆ fatfs_entry_sfn_only()

int fatfs_entry_sfn_only | ( | struct fat_dir_entry * | entry | ) |

Definition at line 142 of file fat_misc.c.

References fat_dir_entry::Attr, FILE_ATTR_LFN_TEXT, FILE_ATTR_SYSHID, FILE_ATTR_VOLUME_ID, FILE_HEADER_BLANK, FILE_HEADER_DELETED, and fat_dir_entry::Name.

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

## ◆ fatfs_filename_to_lfn()

void fatfs_filename_to_lfn | ( | char * | filename,
|  | uint8 * | buffer,
|  | int | entry,
|  | uint8 | sfnChk
| ) |  |

Definition at line 186 of file fat_misc.c.

References buffer, FAT_DIR_ENTRY_SIZE, fatfs_lfn_entries_required(), MAX_LFN_ENTRY_LENGTH, memset(), and strlen().

Here is the call graph for this function:

## ◆ fatfs_lfn_cache_entry()

void fatfs_lfn_cache_entry | ( | struct lfn_cache * | lfn,
|  | uint8 * | entryBuffer
| ) |  |

Definition at line 56 of file fat_misc.c.

References MAX_LFN_ENTRY_LENGTH, MAX_LONGFILENAME_ENTRIES, lfn_cache::no_of_strings, and lfn_cache::String.

Referenced by fatfs_get_file_entry(), and fatfs_list_directory_next().

## ◆ fatfs_lfn_cache_get()

char* fatfs_lfn_cache_get | ( | struct lfn_cache * | lfn | ) |

Definition at line 94 of file fat_misc.c.

References MAX_LONGFILENAME_ENTRIES, lfn_cache::no_of_strings, lfn_cache::Null, and lfn_cache::String.

Referenced by fatfs_get_file_entry(), and fatfs_list_directory_next().

## ◆ fatfs_lfn_cache_init()

void fatfs_lfn_cache_init | ( | struct lfn_cache * | lfn,
|  | int | wipeTable
| ) |  |

Definition at line 38 of file fat_misc.c.

References MAX_LFN_ENTRY_LENGTH, MAX_LONGFILENAME_ENTRIES, memset(), lfn_cache::no_of_strings, and lfn_cache::String.

Referenced by fatfs_get_file_entry(), and fatfs_list_directory_next().

Here is the call graph for this function:

## ◆ fatfs_lfn_create_sfn()

int fatfs_lfn_create_sfn | ( | char * | sfn_output,
|  | char * | filename
| ) |  |

Definition at line 260 of file fat_misc.c.

References FAT_SFN_SIZE_FULL, FAT_SFN_SIZE_PARTIAL, memset(), and strlen().

Here is the call graph for this function:

## ◆ fatfs_lfn_entries_required()

int fatfs_lfn_entries_required | ( | char * | filename | ) |

Definition at line 173 of file fat_misc.c.

References MAX_LFN_ENTRY_LENGTH, and strlen().

Referenced by fatfs_add_file_entry(), and fatfs_filename_to_lfn().

Here is the call graph for this function:

## ◆ fatfs_lfn_generate_tail()

int fatfs_lfn_generate_tail | ( | char * | sfn_output,
|  | char * | sfn_input,
|  | uint32 | tailNum
| ) |  |

Definition at line 346 of file fat_misc.c.

References memset().

Here is the call graph for this function:

## ◆ fatfs_print_sector()

void fatfs_print_sector | ( | uint32 | sector,
|  | uint8 * | data
| ) |  |

## ◆ fatfs_sfn_create_entry()

void fatfs_sfn_create_entry | ( | char * | shortfilename,
|  | uint32 | size,
|  | uint32 | startCluster,
|  | struct fat_dir_entry * | entry,
|  | int | dir
| ) |  |

Definition at line 226 of file fat_misc.c.

References fat_dir_entry::Attr, fat_dir_entry::CrtDate, fat_dir_entry::CrtTime, fat_dir_entry::CrtTimeTenth, FAT_HTONL, FAT_HTONS, FAT_SFN_SIZE_FULL, FILE_TYPE_DIR, FILE_TYPE_FILE, fat_dir_entry::FileSize, fat_dir_entry::FstClusHI, fat_dir_entry::FstClusLO, fat_dir_entry::LstAccDate, fat_dir_entry::Name, fat_dir_entry::NTRes, fat_dir_entry::WrtDate, and fat_dir_entry::WrtTime.

buffer
char * buffer
Definition: shell.c:47
uint8
unsigned char uint8
Definition: fat_types.h:15