From d20e9438cec2ce6d495ff4168da6852cf58c6964 Mon Sep 17 00:00:00 2001 From: Leo C Date: Mon, 28 May 2018 01:33:27 +0200 Subject: [PATCH] Adaptions for fatfs R0.13b --- avr/Tupfile | 5 +++-- avr/cmd_fat.c | 2 +- avr/cmd_sd.c | 16 ++++++++-------- include/ff.h | 2 +- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/avr/Tupfile b/avr/Tupfile index d41de25..05e7e69 100644 --- a/avr/Tupfile +++ b/avr/Tupfile @@ -2,7 +2,8 @@ include_rules PROG = stamp-monitor -FATFS = $(TOP)/fatfs/src/ff.c +FATFSD = $(TOP)/fatfs/source +FATFS = $(FATFSD)/ff.c $(FATFSD)/ffunicode.c SRC = main.c SRC += cli.c cli_readline.c command.c command_tbl.c @@ -13,7 +14,7 @@ SRC += env.c xmalloc.c con-utils.c print-utils.c SRC += getopt-min.c eval_arg.c SRC += timer.c serial.c i2c.c bcd.c pcf8583.c mmc.c SRC += background.c z180-serv.c z80-if.c gpio.c -SRC += $(FATFS) $(TOP)/fatfs/src/option/unicode.c +SRC += $(FATFS) #TODO: time lib SRC += ../time/asctime_r.c ../time/gmtime_r.c ../time/mk_gmtime.c diff --git a/avr/cmd_fat.c b/avr/cmd_fat.c index fcf5cbc..20d1da9 100644 --- a/avr/cmd_fat.c +++ b/avr/cmd_fat.c @@ -124,7 +124,7 @@ FRESULT scan_files ( i = strlen(path); while (((res = f_readdir(&dirs, &statp->Finfo)) == FR_OK) && statp->Finfo.fname[0]) { - if (_FS_RPATH && statp->Finfo.fname[0] == '.') + if (FF_FS_RPATH && statp->Finfo.fname[0] == '.') continue; fn = statp->Finfo.fname; if (statp->Finfo.fattrib & AM_DIR) { diff --git a/avr/cmd_sd.c b/avr/cmd_sd.c index b84c4be..91007f9 100644 --- a/avr/cmd_sd.c +++ b/avr/cmd_sd.c @@ -126,7 +126,7 @@ command_ret_t do_dump(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { static BYTE dev_last; static DWORD sec_last; - BYTE buffer[_MAX_SS]; + BYTE buffer[FF_MAX_SS]; char header[20]; DRESULT res; @@ -162,7 +162,7 @@ command_ret_t do_dump(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) } sprintf_P(header, PSTR("Sector: %lu"), sec); - dump_ram(buffer, 0, _MAX_SS, header); + dump_ram(buffer, 0, FF_MAX_SS, header); } dev_last = dev; sec_last = sec; @@ -182,7 +182,7 @@ command_ret_t do_read(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) DWORD sec; uint32_t addr; int count, nr; - BYTE buffer[_MAX_SS]; + BYTE buffer[FF_MAX_SS]; static DWORD sec_last; static uint32_t addr_last; @@ -214,9 +214,9 @@ command_ret_t do_read(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) my_puts_P(PSTR("Bus timeout\n")); return CMD_RET_FAILURE; } - z80_write_block(buffer, addr /*+ base*/, _MAX_SS); + z80_write_block(buffer, addr /*+ base*/, FF_MAX_SS); z80_bus_cmd(Release); - sec++; addr += _MAX_SS; + sec++; addr += FF_MAX_SS; } else break; } @@ -244,7 +244,7 @@ command_ret_t do_write(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[] DWORD sec; uint32_t addr; int count, nr; - BYTE buffer[_MAX_SS]; + BYTE buffer[FF_MAX_SS]; static DWORD sec_last; static uint32_t addr_last; @@ -275,13 +275,13 @@ command_ret_t do_write(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[] my_puts_P(PSTR("Bus timeout\n")); return CMD_RET_FAILURE; } - z80_read_block(buffer, addr /*+ base*/, _MAX_SS); + z80_read_block(buffer, addr /*+ base*/, FF_MAX_SS); z80_bus_cmd(Release); res = disk_write(dev, buffer, sec, 1); if (res != RES_OK) break; - sec++; addr += _MAX_SS; + sec++; addr += FF_MAX_SS; } printf_P(PSTR("%d sector(s) written, rc=%.2x.\n"), nr, res); diff --git a/include/ff.h b/include/ff.h index 7fb6cb1..6dd8d56 120000 --- a/include/ff.h +++ b/include/ff.h @@ -1 +1 @@ -../fatfs/src/ff.h \ No newline at end of file +../fatfs/source/ff.h \ No newline at end of file -- 2.39.2