From 7af9364ebd7ad6c143f31e9abe745c6d75f8322b Mon Sep 17 00:00:00 2001 From: Leo C Date: Sat, 10 Sep 2016 01:51:36 +0200 Subject: [PATCH] Adaptions for fatfs R0.12b --- avr/cmd_fat.c | 34 ++++++++++------------------------ include/avr/ffconf.h | 4 ++-- include/z180-serv.h | 1 + libopencm3 | 2 +- 4 files changed, 14 insertions(+), 27 deletions(-) diff --git a/avr/cmd_fat.c b/avr/cmd_fat.c index 6ffbb79..fcf5cbc 100644 --- a/avr/cmd_fat.c +++ b/avr/cmd_fat.c @@ -69,21 +69,21 @@ static const FLASH char * const FLASH rc_names[] = { FSTR("TIMEOUT"), FSTR("LOCKED"), FSTR("NOT_ENOUGH_CORE"), - FSTR("TOO_MANY_OPEN_FILES") + FSTR("TOO_MANY_OPEN_FILES"), + FSTR("INVALID_PARAMETER") }; static void put_rc (FRESULT rc) { - if (rc < ARRAY_SIZE(rc_names)) { #if GCC_BUG_61443 - printf_P(PSTR("rc=%u FR_"), rc); - my_puts_P(rc_names[rc]); - my_puts_P(PSTR("\n")); + printf_P(PSTR("rc=%u FR_"), rc); + my_puts_P(rc < ARRAY_SIZE(rc_names) ? rc_names[rc] : PSTR(" Unknown Error")); + my_puts_P(PSTR("\n")); #else - printf_P(PSTR("rc=%u FR_%S\n"), rc, rc_names[rc]); + printf_P(PSTR("rc=%u FR_%S\n"), rc, + rc < ARRAY_SIZE(rc_names) ? rc_names[rc] : PSTR(" Unknown Error")); #endif - } } @@ -236,11 +236,6 @@ command_ret_t do_fat_ls(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[ unsigned long p1; unsigned int s1, s2; FRESULT res; -#if _USE_LFN - char Lfname[_MAX_LFN+1]; - Finfo.lfname = Lfname; - Finfo.lfsize = sizeof Lfname; -#endif (void) cmdtp; (void) flag; (void) argc; @@ -260,19 +255,15 @@ command_ret_t do_fat_ls(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[ } else { s1++; p1 += Finfo.fsize; } - printf_P(PSTR("%c%c%c%c%c %u/%02u/%02u %02u:%02u %9lu "), + printf_P(PSTR("%c%c%c%c%c %u/%02u/%02u %02u:%02u %9lu %s\n"), (Finfo.fattrib & AM_DIR) ? 'D' : '-', (Finfo.fattrib & AM_RDO) ? 'R' : '-', (Finfo.fattrib & AM_HID) ? 'H' : '-', (Finfo.fattrib & AM_SYS) ? 'S' : '-', (Finfo.fattrib & AM_ARC) ? 'A' : '-', (Finfo.fdate >> 9) + 1980, (Finfo.fdate >> 5) & 15, Finfo.fdate & 31, - (Finfo.ftime >> 11), (Finfo.ftime >> 5) & 63, Finfo.fsize); -#if _USE_LFN - printf_P(PSTR("%s\n"), *Lfname ? Lfname : Finfo.fname); -#else - printf_P(PSTR("%s\n"), Finfo.fname); -#endif + (Finfo.ftime >> 11), (Finfo.ftime >> 5) & 63, + Finfo.fsize, Finfo.fname); if (check_abort()) break; } @@ -301,11 +292,6 @@ FRESULT mkpath(TCHAR *path) TCHAR *p, *q; FRESULT ret; -#if _USE_LFN - fd.lfname = 0; -#endif - - res = f_stat (path, &fd) p = strchr(path, ':'); diff --git a/include/avr/ffconf.h b/include/avr/ffconf.h index 99b685c..2acce32 100644 --- a/include/avr/ffconf.h +++ b/include/avr/ffconf.h @@ -25,7 +25,7 @@ / 3: f_lseek() function is removed in addition to 2. */ -#define _USE_STRFUNC 0 +#define _USE_STRFUNC 2 /* This option switches string functions, f_gets(), f_putc(), f_puts() and / f_printf(). / @@ -225,7 +225,7 @@ / defined by _NORTC_MON, _NORTC_MDAY and _NORTC_YEAR in local time. / To enable timestamp function (_FS_NORTC = 0), get_fattime() function need to be / added to the project to get current time form real-time clock. _NORTC_MON, -/ _NORTC_MDAY and _NORTC_YEAR have no effect. +/ _NORTC_MDAY and _NORTC_YEAR have no effect. / These options have no effect at read-only configuration (_FS_READONLY = 1). */ diff --git a/include/z180-serv.h b/include/z180-serv.h index b6a65b0..3b4a462 100644 --- a/include/z180-serv.h +++ b/include/z180-serv.h @@ -7,6 +7,7 @@ #ifndef Z180_SERV_H #define Z180_SERV_H +#include #include #include "ff.h" diff --git a/libopencm3 b/libopencm3 index 4a49907..ec22543 160000 --- a/libopencm3 +++ b/libopencm3 @@ -1 +1 @@ -Subproject commit 4a49907bfdc334b7ab42f64537c930cd71293697 +Subproject commit ec22543ce8d595b19607b067cd27c081808fc425 -- 2.39.2