Go to the documentation of this file.
43 #if FATFS_INC_LFN_SUPPORT
55 #if FATFS_INC_LFN_SUPPORT
58 LFNIndex = entryBuffer[0] & 0x1F;
71 lfn->
String[LFNIndex - 1][0] = entryBuffer[1];
72 lfn->
String[LFNIndex - 1][1] = entryBuffer[3];
73 lfn->
String[LFNIndex - 1][2] = entryBuffer[5];
74 lfn->
String[LFNIndex - 1][3] = entryBuffer[7];
75 lfn->
String[LFNIndex - 1][4] = entryBuffer[9];
76 lfn->
String[LFNIndex - 1][5] = entryBuffer[0x0E];
77 lfn->
String[LFNIndex - 1][6] = entryBuffer[0x10];
78 lfn->
String[LFNIndex - 1][7] = entryBuffer[0x12];
79 lfn->
String[LFNIndex - 1][8] = entryBuffer[0x14];
80 lfn->
String[LFNIndex - 1][9] = entryBuffer[0x16];
81 lfn->
String[LFNIndex - 1][10] = entryBuffer[0x18];
82 lfn->
String[LFNIndex - 1][11] = entryBuffer[0x1C];
83 lfn->
String[LFNIndex - 1][12] = entryBuffer[0x1E];
86 if (lfn->
String[LFNIndex - 1][i] == 0xFF)
87 lfn->
String[LFNIndex - 1][i] = 0x20;
93 #if FATFS_INC_LFN_SUPPORT
103 return (
char*) &lfn->
String[0][0];
109 #if FATFS_INC_LFN_SUPPORT
120 #if FATFS_INC_LFN_SUPPORT
131 #if FATFS_INC_LFN_SUPPORT
172 #if FATFS_INC_LFN_SUPPORT
174 int length = (int)
strlen(filename);
185 #if FATFS_INC_LFN_SUPPORT
188 int nameIndexes[
MAX_LFN_ENTRY_LENGTH] = { 1, 3, 5, 7, 9, 0x0E, 0x10, 0x12, 0x14, 0x16, 0x18, 0x1C, 0x1E };
191 int length = (int)
strlen(filename);
201 buffer[0] = (
uint8) (((entriesRequired - 1) == entry) ? (0x40 | (entry + 1)) : (entry + 1));
211 if ((start + i) < length)
212 buffer[nameIndexes[i]] = filename[start + i];
213 else if ((start + i) == length)
214 buffer[nameIndexes[i]] = 0x00;
216 buffer[nameIndexes[i]] = 0xFF;
217 buffer[nameIndexes[i] + 1] = 0xFF;
225 #if FATFS_INC_WRITE_SUPPORT
231 entry->
Name[i] = shortfilename[i];
259 #if FATFS_INC_WRITE_SUPPORT
265 int len = (int)
strlen(filename);
268 if (filename[0] ==
'.')
275 for (i = 0; i < len; i++) {
276 if (filename[i] ==
'.')
283 for (i = (dotPos + 1); i < (dotPos + 1 + 3); i++)
285 ext[i - (dotPos + 1)] = filename[i];
293 for (i = 0; i < len; i++) {
294 if ((filename[i] !=
' ') && (filename[i] !=
'.')) {
295 if (filename[i] >=
'a' && filename[i] <=
'z')
296 sfn_output[pos++] = filename[i] -
'a' +
'A';
298 sfn_output[pos++] = filename[i];
319 static void fatfs_itoa(
uint32 num,
char *s) {
322 const char digits[] =
"0123456789ABCDEF";
327 *cp++ = digits[(int) (num % 10)];
328 }
while ((num /= 10) > 0);
344 #if FATFS_INC_LFN_SUPPORT
345 #if FATFS_INC_WRITE_SUPPORT
354 memset(tail_str, 0x00,
sizeof(tail_str));
356 fatfs_itoa(tailNum, tail_str + 1);
362 tail_chars = (int)
strlen(tail_str);
372 #if FATFS_INC_TIME_DATE_SUPPORT
453 char ch = data[i-15+j];
456 if (ch > 31 && ch < 127)
#define FAT_TIME_MINUTES_MASK
#define FILE_ATTR_VOLUME_ID
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)
uint16 fatfs_convert_to_fat_time(int hours, int minutes, int seconds)
int fatfs_entry_is_file(struct fat_dir_entry *entry)
char * fatfs_lfn_cache_get(struct lfn_cache *lfn)
int fatfs_lfn_entries_required(char *filename)
uint16 fatfs_convert_to_fat_date(int day, int month, int year)
int strlen(const char *str)
#define FAT_DATE_MONTH_MASK
void fatfs_lfn_cache_entry(struct lfn_cache *lfn, uint8 *entryBuffer)
#define FAT_TIME_SECONDS_SHIFT
#define FAT_DATE_YEAR_MASK
#define FILE_HEADER_BLANK
void * memcpy(const void *dst, const void *src, size_t length)
int fatfs_entry_sfn_only(struct fat_dir_entry *entry)
int fatfs_entry_lfn_text(struct fat_dir_entry *entry)
#define FAT_DIR_ENTRY_SIZE
#define MAX_LONGFILENAME_ENTRIES
#define FAT_SFN_SIZE_FULL
#define FAT_DATE_DAY_SHIFT
#define MAX_LFN_ENTRY_LENGTH
void fatfs_convert_from_fat_time(uint16 fat_time, int *hours, int *minutes, int *seconds)
#define FAT_SFN_SIZE_PARTIAL
void fatfs_lfn_cache_init(struct lfn_cache *lfn, int wipeTable)
void fatfs_filename_to_lfn(char *filename, uint8 *buffer, int entry, uint8 sfnChk)
int fatfs_entry_lfn_invalid(struct fat_dir_entry *entry)
#define FAT_TIME_MINUTES_SHIFT
#define FAT_TIME_HOURS_SHIFT
int fatfs_entry_lfn_exists(struct lfn_cache *lfn, struct fat_dir_entry *entry)
#define FAT_TIME_HOURS_MASK
#define FAT_TIME_SECONDS_MASK
void * memset(void *dst, int c, size_t length)
#define FILE_HEADER_DELETED
int fatfs_entry_is_dir(struct fat_dir_entry *entry)
int fatfs_lfn_generate_tail(char *sfn_output, char *sfn_input, uint32 tailNum)
void fatfs_convert_from_fat_date(uint16 fat_date, int *day, int *month, int *year)
#define FAT_TIME_SECONDS_SCALE
#define FAT_DATE_YEAR_SHIFT
#define FAT_DATE_YEAR_OFFSET
#define FILE_ATTR_LFN_TEXT
#define FAT_DATE_DAY_MASK
#define FAT_DATE_MONTH_SHIFT
int fatfs_lfn_create_sfn(char *sfn_output, char *filename)