mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-25 06:23:53 +01:00
pkg/fatfs: switched to git mirror for downloading FatFs code instead of authors webserver, added Makefile.dep for fatfs, cleanup code for using rtc
This commit is contained in:
parent
e0f60ba10a
commit
938fe26757
@ -8,10 +8,6 @@ OLD_USEPKG := $(sort $(USEPKG))
|
||||
# pull dependencies from drivers
|
||||
include $(RIOTBASE)/drivers/Makefile.dep
|
||||
|
||||
ifneq (,$(filter fatfs_diskio_sdcard_spi,$(USEMODULE)))
|
||||
USEMODULE += sdcard_spi
|
||||
endif
|
||||
|
||||
ifneq (,$(filter csma_sender,$(USEMODULE)))
|
||||
USEMODULE += random
|
||||
USEMODULE += xtimer
|
||||
|
||||
@ -1,58 +1,13 @@
|
||||
PKG_NAME = fatfs
|
||||
PKG_URL = elm-chan.org/fsw/ff/arc
|
||||
PKG_VERSION = ff12b
|
||||
PKG_EXT = zip
|
||||
PKG_FILE = $(PKG_NAME)-$(PKG_VERSION).$(PKG_EXT)
|
||||
PKG_BUILDDIR = $(PKGDIRBASE)/$(PKG_NAME)
|
||||
MODULE_MAKEFILE := $(CURDIR)/Makefile.module
|
||||
PKG_NAME=fatfs
|
||||
PKG_URL=https://github.com/MichelRottleuthner/FatFs_for_RIOT.git
|
||||
PKG_VERSION=61fd6ae3815170bf7bf6121f33f1ef68c2b11599
|
||||
PKG_LICENSE=BSD-1-Clause
|
||||
MODULE_MAKEFILE := $(CURDIR)/Makefile.fatfs
|
||||
|
||||
ifneq ($(RIOTBASE),)
|
||||
include $(RIOTBASE)/Makefile.base
|
||||
endif
|
||||
.PHONY: all
|
||||
|
||||
.PHONY: all clean patch
|
||||
|
||||
all: $(PKG_BUILDDIR)/.patched
|
||||
|
||||
ffconf_patches += $(CURDIR)/patches/enable_use_lable.patch
|
||||
ffconf_patches += $(CURDIR)/patches/set_code_page_to_ascii.patch
|
||||
ffconf_patches += $(CURDIR)/patches/enable_use_mkfs.patch
|
||||
ffconf_patches += $(CURDIR)/patches/enable_fs_tiny.patch
|
||||
|
||||
#if periph_rtc is available use it. Otherwise use static timestamps
|
||||
ifeq (, $(filter $(periph_rtc), $(FEATURES_PROVIDED)))
|
||||
ffconf_patches += $(CURDIR)/patches/disable_rtc.patch
|
||||
FEATURES_REQUIRED += periph_rtc
|
||||
endif
|
||||
|
||||
$(PKG_BUILDDIR)/.patched: $(PKG_BUILDDIR)/.prepared
|
||||
@$(foreach p, $(ffconf_patches), patch $(PKG_BUILDDIR)/ffconf.h < $(p);)
|
||||
@patch $(PKG_BUILDDIR)/integer.h < $(CURDIR)/patches/remove_int_type.patch
|
||||
@patch $(PKG_BUILDDIR)/ff.c < $(CURDIR)/patches/fix_for_guards.patch
|
||||
@touch $@
|
||||
|
||||
$(PKG_BUILDDIR)/.prepared: $(PKG_BUILDDIR)/.extracted
|
||||
@mv $(PKG_BUILDDIR)/src/* $(PKG_BUILDDIR)/
|
||||
@rm -rf $(PKG_BUILDDIR)/src
|
||||
@rm -rf $(PKG_BUILDDIR)/doc
|
||||
|
||||
#this file is only a dummy that should be replaced by a compatible implementation
|
||||
@rm $(PKG_BUILDDIR)/diskio.c
|
||||
all: git-download
|
||||
@cp $(MODULE_MAKEFILE) $(PKG_BUILDDIR)/Makefile
|
||||
@touch $@
|
||||
"$(MAKE)" -C $(PKG_BUILDDIR)
|
||||
|
||||
$(PKG_BUILDDIR)/.extracted: $(PKG_BUILDDIR)/$(PKG_FILE)
|
||||
@mkdir -p $(@D)
|
||||
@cd $(@D) && $(UNZIP_HERE) $(<)
|
||||
@touch $@
|
||||
|
||||
$(PKG_BUILDDIR)/$(PKG_FILE):
|
||||
@mkdir -p $(@D)
|
||||
@$(DOWNLOAD_TO_FILE) $@ $(PKG_URL)/$(PKG_VERSION).$(PKG_EXT)
|
||||
|
||||
clean::
|
||||
#delete all files except the downloaded zip file
|
||||
@ls -A $(PKG_BUILDDIR)/ | grep -v $(PKG_FILE) | xargs -I % rm -rf $(PKG_BUILDDIR)/%
|
||||
|
||||
distclean::
|
||||
@rm -rf $(PKG_BUILDDIR)
|
||||
include $(RIOTBASE)/pkg/pkg.mk
|
||||
|
||||
16
pkg/fatfs/Makefile.dep
Normal file
16
pkg/fatfs/Makefile.dep
Normal file
@ -0,0 +1,16 @@
|
||||
ifneq (,$(filter fatfs_diskio_sdcard_spi,$(USEMODULE)))
|
||||
USEMODULE += sdcard_spi
|
||||
endif
|
||||
|
||||
ifneq (,$(filter fatfs,$(USEPKG)))
|
||||
USEMODULE += fatfs_diskio_common
|
||||
endif
|
||||
|
||||
include $(RIOTBASE)/boards/$(BOARD)/Makefile.features
|
||||
|
||||
#if periph_rtc is available use it. Otherwise use static timestamps
|
||||
ifneq (, $(filter periph_rtc, $(FEATURES_PROVIDED)))
|
||||
export CFLAGS+= -DFATFS_FFCONF_OPT_FS_NORTC=0
|
||||
else
|
||||
export CFLAGS+= -DFATFS_FFCONF_OPT_FS_NORTC=1
|
||||
endif
|
||||
@ -1 +1,3 @@
|
||||
MODULE=fatfs
|
||||
|
||||
include $(RIOTBASE)/Makefile.base
|
||||
@ -1,7 +1,9 @@
|
||||
INCLUDES += -I$(PKGDIRBASE)
|
||||
INCLUDES += -I$(RIOTPKG)/fatfs/fatfs_diskio/include
|
||||
INCLUDES += -I$(RIOTPKG)/fatfs/fatfs_diskio/common/include
|
||||
DIRS += $(PKGDIRBASE)/fatfs
|
||||
|
||||
DIRS += $(RIOTBASE)/pkg/fatfs/fatfs_diskio/common
|
||||
|
||||
ifneq (,$(filter fatfs_diskio_native,$(USEMODULE)))
|
||||
DIRS += $(RIOTBASE)/pkg/fatfs/fatfs_diskio/native
|
||||
endif
|
||||
|
||||
@ -1,2 +1,3 @@
|
||||
MODULE = fatfs_diskio
|
||||
MODULE = fatfs_diskio_common
|
||||
|
||||
include $(RIOTBASE)/Makefile.base
|
||||
@ -21,13 +21,11 @@
|
||||
|
||||
#include "fatfs/diskio.h" /* FatFs lower layer API */
|
||||
#include "fatfs_diskio_common.h"
|
||||
#include "time.h"
|
||||
#include "stdint.h"
|
||||
|
||||
#ifdef FATFS_RTC_AVAILABLE
|
||||
#define FATFS_DISKIO_FATTIME_YEAR_OFFS 25
|
||||
#define FATFS_DISKIO_FATTIME_MON_OFFS 21
|
||||
#define FATFS_DISKIO_FATTIME_DAY_OFFS 16
|
||||
#define FATFS_DISKIO_FATTIME_HH_OFFS 11
|
||||
#define FATFS_DISKIO_FATTIME_MM_OFFS 5
|
||||
#if FATFS_FFCONF_OPT_FS_NORTC == 0
|
||||
#include "periph/rtc.h"
|
||||
|
||||
DWORD get_fattime(void)
|
||||
{
|
||||
@ -24,24 +24,18 @@ extern "C" {
|
||||
|
||||
#include "fatfs/diskio.h" /* FatFs lower layer API */
|
||||
|
||||
#define CTRL_SYNC 0 /* Complete pending write process
|
||||
(needed when _FS_READONLY == 0) */
|
||||
#define RTC_YEAR_OFFSET (1900)
|
||||
#define FATFS_YEAR_OFFSET (1980)
|
||||
|
||||
#define GET_SECTOR_COUNT 1 /* (needed when _USE_MKFS == 1) */
|
||||
#define FIXED_BLOCK_SIZE (512)
|
||||
|
||||
#define GET_SECTOR_SIZE 2 /* (needed when _MAX_SS > 512 ) */
|
||||
#define FATFS_DISKIO_DSTASTUS_OK (0)
|
||||
|
||||
#define GET_BLOCK_SIZE 3 /* erase block size (needed when _USE_MKFS == 1) */
|
||||
|
||||
#define CTRL_TRIM 4 /* Inform device about no longer needed data blocks
|
||||
(needed when _USE_TRIM == 1) */
|
||||
|
||||
#define RTC_YEAR_OFFSET 1900
|
||||
#define FATFS_YEAR_OFFSET 1980
|
||||
|
||||
#define FIXED_BLOCK_SIZE 512
|
||||
|
||||
#define FATFS_DISKIO_DSTASTUS_OK 0
|
||||
#define FATFS_DISKIO_FATTIME_YEAR_OFFS (25)
|
||||
#define FATFS_DISKIO_FATTIME_MON_OFFS (21)
|
||||
#define FATFS_DISKIO_FATTIME_DAY_OFFS (16)
|
||||
#define FATFS_DISKIO_FATTIME_HH_OFFS (11)
|
||||
#define FATFS_DISKIO_FATTIME_MM_OFFS (5)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
@ -2,10 +2,4 @@ MODULE = fatfs_diskio_sdcard_spi
|
||||
|
||||
USEMODULE += sdcard_spi
|
||||
|
||||
#if periph_rtc is available use it. Otherwise use static timestamps
|
||||
ifneq (, $(filter $(periph_rtc), $(FEATURES_PROVIDED)))
|
||||
CFLAGS += -DFATFS_RTC_AVAILABLE
|
||||
USEMODULE += periph_rtc
|
||||
endif
|
||||
|
||||
include $(RIOTBASE)/Makefile.base
|
||||
|
||||
@ -1,11 +0,0 @@
|
||||
--- ffconf.h 2016-09-04 21:41:04.000000000 +0200
|
||||
+++ ffconf_patched.h 2016-11-29 22:04:09.000000000 +0100
|
||||
@@ -215,7 +215,7 @@
|
||||
/ Note that enabling exFAT discards C89 compatibility. */
|
||||
|
||||
|
||||
-#define _FS_NORTC 0
|
||||
+#define _FS_NORTC 1
|
||||
#define _NORTC_MON 1
|
||||
#define _NORTC_MDAY 1
|
||||
#define _NORTC_YEAR 2016
|
||||
@ -1,11 +0,0 @@
|
||||
--- ./bin/pkg/native/fatfs/ffconf.h 2017-05-08 12:19:04.813286471 +0200
|
||||
+++ ./bin/pkg/native/fatfs/ffconf_patched.h 2017-05-08 12:19:28.785574968 +0200
|
||||
@@ -202,7 +202,7 @@
|
||||
/ System Configurations
|
||||
/---------------------------------------------------------------------------*/
|
||||
|
||||
-#define _FS_TINY 0
|
||||
+#define _FS_TINY 1
|
||||
/* This option switches tiny buffer configuration. (0:Normal or 1:Tiny)
|
||||
/ At the tiny configuration, size of file object (FIL) is reduced _MAX_SS bytes.
|
||||
/ Instead of private sector buffer eliminated from the file object, common sector
|
||||
@ -1,11 +0,0 @@
|
||||
--- ffconf.h 2016-10-14 16:11:35.060659327 +0200
|
||||
+++ ffconf_patched.h 2016-10-17 12:17:56.767995083 +0200
|
||||
@@ -56,7 +56,7 @@
|
||||
/ (0:Disable or 1:Enable) Also _FS_READONLY needs to be 0 to enable this option. */
|
||||
|
||||
|
||||
-#define _USE_LABEL 0
|
||||
+#define _USE_LABEL 1
|
||||
/* This option switches volume label functions, f_getlabel() and f_setlabel().
|
||||
/ (0:Disable or 1:Enable) */
|
||||
|
||||
@ -1,11 +0,0 @@
|
||||
--- ffconf.h 2016-12-20 19:46:33.302977112 +0100
|
||||
+++ ffconf_patched.h 2016-12-20 19:57:08.246791926 +0100
|
||||
@@ -39,7 +39,7 @@
|
||||
/ f_findnext(). (0:Disable, 1:Enable 2:Enable with matching altname[] too) */
|
||||
|
||||
|
||||
-#define _USE_MKFS 0
|
||||
+#define _USE_MKFS 1
|
||||
/* This option switches f_mkfs() function. (0:Disable or 1:Enable) */
|
||||
|
||||
|
||||
@ -1,194 +0,0 @@
|
||||
--- ./bin/pkg/airfy-beacon/fatfs/ff.c 2016-09-04 21:41:04.000000000 +0200
|
||||
+++ ./bin/pkg/airfy-beacon/fatfs/ff_patched.c 2017-05-08 21:38:41.707271829 +0200
|
||||
@@ -784,7 +784,7 @@
|
||||
{
|
||||
UINT i;
|
||||
|
||||
- for (i = 0; i < _FS_LOCK && Files[i].fs; i++) ;
|
||||
+ for (i = 0; i < _FS_LOCK && Files[i].fs; i++) {} ;
|
||||
return (i == _FS_LOCK) ? 0 : 1;
|
||||
}
|
||||
|
||||
@@ -805,7 +805,7 @@
|
||||
}
|
||||
|
||||
if (i == _FS_LOCK) { /* Not opened. Register it as new. */
|
||||
- for (i = 0; i < _FS_LOCK && Files[i].fs; i++) ;
|
||||
+ for (i = 0; i < _FS_LOCK && Files[i].fs; i++) {} ;
|
||||
if (i == _FS_LOCK) return 0; /* No free entry to register (int err) */
|
||||
Files[i].fs = dp->obj.fs;
|
||||
Files[i].clu = dp->obj.sclust;
|
||||
@@ -1270,7 +1270,7 @@
|
||||
#if _FS_EXFAT || _USE_TRIM
|
||||
if (ecl + 1 == nxt) { /* Is next cluster contiguous? */
|
||||
ecl = nxt;
|
||||
- } else { /* End of contiguous cluster block */
|
||||
+ } else { /* End of contiguous cluster block */
|
||||
#if _FS_EXFAT
|
||||
if (fs->fs_type == FS_EXFAT) {
|
||||
res = change_bitmap(fs, scl, ecl - scl + 1, 0); /* Mark the cluster block 'free' on the bitmap */
|
||||
@@ -1978,12 +1978,12 @@
|
||||
}
|
||||
|
||||
|
||||
-#if !_FS_READONLY || _FS_RPATH != 0
|
||||
+#if !_FS_READONLY || _FS_RPATH != 0
|
||||
/*------------------------------------------------*/
|
||||
/* exFAT: Load the object's directory entry block */
|
||||
/*------------------------------------------------*/
|
||||
static
|
||||
-FRESULT load_obj_dir (
|
||||
+FRESULT load_obj_dir (
|
||||
DIR* dp, /* Blank directory object to be used to access containing direcotry */
|
||||
const _FDID* obj /* Object with containing directory information */
|
||||
)
|
||||
@@ -2254,7 +2254,7 @@
|
||||
|
||||
|
||||
if (dp->fn[NSFLAG] & (NS_DOT | NS_NONAME)) return FR_INVALID_NAME; /* Check name validity */
|
||||
- for (nlen = 0; fs->lfnbuf[nlen]; nlen++) ; /* Get lfn length */
|
||||
+ for (nlen = 0; fs->lfnbuf[nlen]; nlen++) {} ; /* Get lfn length */
|
||||
|
||||
#if _FS_EXFAT
|
||||
if (fs->fs_type == FS_EXFAT) { /* On the exFAT volume */
|
||||
@@ -2623,7 +2623,7 @@
|
||||
|
||||
/* Create SFN in directory form */
|
||||
mem_set(dp->fn, ' ', 11);
|
||||
- for (si = 0; lfn[si] == ' ' || lfn[si] == '.'; si++) ; /* Strip leading spaces and dots */
|
||||
+ for (si = 0; lfn[si] == ' ' || lfn[si] == '.'; si++) {} ; /* Strip leading spaces and dots */
|
||||
if (si) cf |= NS_LOSS | NS_LFN;
|
||||
while (di && lfn[di - 1] != '.') di--; /* Find extension (di<=si: no extension) */
|
||||
|
||||
@@ -2866,10 +2866,10 @@
|
||||
|
||||
|
||||
if (*path) { /* If the pointer is not a null */
|
||||
- for (tt = *path; (UINT)*tt >= (_USE_LFN ? ' ' : '!') && *tt != ':'; tt++) ; /* Find ':' in the path */
|
||||
+ for (tt = *path; (UINT)*tt >= (_USE_LFN ? ' ' : '!') && *tt != ':'; tt++) {} ; /* Find ':' in the path */
|
||||
if (*tt == ':') { /* If a ':' is exist in the path name */
|
||||
tp = *path;
|
||||
- i = *tp++ - '0';
|
||||
+ i = *tp++ - '0';
|
||||
if (i < 10 && tp == tt) { /* Is there a numeric drive id? */
|
||||
if (i < _VOLUMES) { /* If a drive id is found, get the value and strip it */
|
||||
vol = (int)i;
|
||||
@@ -3017,7 +3017,7 @@
|
||||
if (fmt == 1) {
|
||||
QWORD maxlba;
|
||||
|
||||
- for (i = BPB_ZeroedEx; i < BPB_ZeroedEx + 53 && fs->win[i] == 0; i++) ; /* Check zero filler */
|
||||
+ for (i = BPB_ZeroedEx; i < BPB_ZeroedEx + 53 && fs->win[i] == 0; i++) {} ; /* Check zero filler */
|
||||
if (i < BPB_ZeroedEx + 53) return FR_NO_FILESYSTEM;
|
||||
|
||||
if (ld_word(fs->win + BPB_FSVerEx) != 0x100) return FR_NO_FILESYSTEM; /* Check exFAT revision (Must be 1.0) */
|
||||
@@ -3891,7 +3891,7 @@
|
||||
if (res == FR_NO_FILE) res = FR_INT_ERR;/* It cannot be 'not found'. */
|
||||
if (res != FR_OK) break;
|
||||
get_fileinfo(&dj, &fno); /* Get the directory name and push it to the buffer */
|
||||
- for (n = 0; fno.fname[n]; n++) ;
|
||||
+ for (n = 0; fno.fname[n]; n++) {} ;
|
||||
if (i < n + 3) {
|
||||
res = FR_NOT_ENOUGH_CORE; break;
|
||||
}
|
||||
@@ -4939,7 +4939,7 @@
|
||||
dj.obj.fs = fs;
|
||||
|
||||
/* Get length of given volume label */
|
||||
- for (slen = 0; (UINT)label[slen] >= ' '; slen++) ; /* Get name length */
|
||||
+ for (slen = 0; (UINT)label[slen] >= ' '; slen++) {} ; /* Get name length */
|
||||
|
||||
#if _FS_EXFAT
|
||||
if (fs->fs_type == FS_EXFAT) { /* On the exFAT volume */
|
||||
@@ -4960,7 +4960,7 @@
|
||||
} else
|
||||
#endif
|
||||
{ /* On the FAT12/16/32 volume */
|
||||
- for ( ; slen && label[slen - 1] == ' '; slen--) ; /* Remove trailing spaces */
|
||||
+ for ( ; slen && label[slen - 1] == ' '; slen--) {} ; /* Remove trailing spaces */
|
||||
if (slen) { /* Is there a volume label to be set? */
|
||||
dirvn[0] = 0; i = j = 0; /* Create volume label in directory form */
|
||||
do {
|
||||
@@ -5335,7 +5335,7 @@
|
||||
if (ch != si) {
|
||||
si++; break; /* Store the up-case char if exist */
|
||||
}
|
||||
- for (j = 1; (WCHAR)(si + j) && (WCHAR)(si + j) == ff_wtoupper((WCHAR)(si + j)); j++) ; /* Get run length of no-case block */
|
||||
+ for (j = 1; (WCHAR)(si + j) && (WCHAR)(si + j) == ff_wtoupper((WCHAR)(si + j)); j++) {} ; /* Get run length of no-case block */
|
||||
if (j >= 128) {
|
||||
ch = 0xFFFF; st = 2; break; /* Compress the no-case block if run is >= 128 */
|
||||
}
|
||||
@@ -5366,8 +5366,8 @@
|
||||
nb = tbl[0] + tbl[1] + tbl[2]; /* Number of clusters in-use by system */
|
||||
do {
|
||||
mem_set(buf, 0, szb_buf);
|
||||
- for (i = 0; nb >= 8 && i < szb_buf; buf[i++] = 0xFF, nb -= 8) ;
|
||||
- for (b = 1; nb && i < szb_buf; buf[i] |= b, b <<= 1, nb--) ;
|
||||
+ for (i = 0; nb >= 8 && i < szb_buf; buf[i++] = 0xFF, nb -= 8) {} ;
|
||||
+ for (b = 1; nb && i < szb_buf; buf[i] |= b, b <<= 1, nb--) {} ;
|
||||
n = (nsect > sz_buf) ? sz_buf : nsect; /* Write the buffered data */
|
||||
if (disk_write(pdrv, buf, sect, n) != RES_OK) return FR_DISK_ERR;
|
||||
sect += n; nsect -= n;
|
||||
@@ -5427,8 +5427,8 @@
|
||||
st_dword(buf + BPB_RootClusEx, 2 + tbl[0] + tbl[1]); /* Root dir cluster # */
|
||||
st_dword(buf + BPB_VolIDEx, GET_FATTIME()); /* VSN */
|
||||
st_word(buf + BPB_FSVerEx, 0x100); /* File system version (1.00) */
|
||||
- for (buf[BPB_BytsPerSecEx] = 0, i = ss; i >>= 1; buf[BPB_BytsPerSecEx]++) ; /* Log2 of sector size [byte] */
|
||||
- for (buf[BPB_SecPerClusEx] = 0, i = au; i >>= 1; buf[BPB_SecPerClusEx]++) ; /* Log2 of cluster size [sector] */
|
||||
+ for (buf[BPB_BytsPerSecEx] = 0, i = ss; i >>= 1; buf[BPB_BytsPerSecEx]++) {} ; /* Log2 of sector size [byte] */
|
||||
+ for (buf[BPB_SecPerClusEx] = 0, i = au; i >>= 1; buf[BPB_SecPerClusEx]++) {} ; /* Log2 of cluster size [sector] */
|
||||
buf[BPB_NumFATsEx] = 1; /* Number of FATs */
|
||||
buf[BPB_DrvNumEx] = 0x80; /* Drive number (for int13) */
|
||||
st_word(buf + BS_BootCodeEx, 0xFEEB); /* Boot code (x86) */
|
||||
@@ -5441,13 +5441,13 @@
|
||||
mem_set(buf, 0, ss);
|
||||
st_word(buf + ss - 2, 0xAA55); /* Signature (placed at end of sector) */
|
||||
for (j = 1; j < 9; j++) {
|
||||
- for (i = 0; i < ss; sum = xsum32(buf[i++], sum)) ; /* VBR checksum */
|
||||
+ for (i = 0; i < ss; sum = xsum32(buf[i++], sum)) {} ; /* VBR checksum */
|
||||
if (disk_write(pdrv, buf, sect++, 1) != RES_OK) return FR_DISK_ERR;
|
||||
}
|
||||
/* OEM/Reserved record (+9..+10) */
|
||||
mem_set(buf, 0, ss);
|
||||
for ( ; j < 11; j++) {
|
||||
- for (i = 0; i < ss; sum = xsum32(buf[i++], sum)) ; /* VBR checksum */
|
||||
+ for (i = 0; i < ss; sum = xsum32(buf[i++], sum)) {} ; /* VBR checksum */
|
||||
if (disk_write(pdrv, buf, sect++, 1) != RES_OK) return FR_DISK_ERR;
|
||||
}
|
||||
/* Sum record (+11) */
|
||||
@@ -5464,7 +5464,7 @@
|
||||
if (fmt == FS_FAT32) { /* FAT32 volume */
|
||||
if (!pau) { /* au auto-selection */
|
||||
n = sz_vol / 0x20000; /* Volume size in unit of 128KS */
|
||||
- for (i = 0, pau = 1; cst32[i] && cst32[i] <= n; i++, pau <<= 1) ; /* Get from table */
|
||||
+ for (i = 0, pau = 1; cst32[i] && cst32[i] <= n; i++, pau <<= 1) {} ; /* Get from table */
|
||||
}
|
||||
n_clst = sz_vol / pau; /* Number of clusters */
|
||||
sz_fat = (n_clst * 4 + 8 + ss - 1) / ss; /* FAT size [sector] */
|
||||
@@ -5474,7 +5474,7 @@
|
||||
} else { /* FAT12/16 volume */
|
||||
if (!pau) { /* au auto-selection */
|
||||
n = sz_vol / 0x1000; /* Volume size in unit of 4KS */
|
||||
- for (i = 0, pau = 1; cst[i] && cst[i] <= n; i++, pau <<= 1) ; /* Get from table */
|
||||
+ for (i = 0, pau = 1; cst[i] && cst[i] <= n; i++, pau <<= 1) {} ; /* Get from table */
|
||||
}
|
||||
n_clst = sz_vol / pau;
|
||||
if (n_clst > MAX_FAT12) {
|
||||
@@ -5682,7 +5682,7 @@
|
||||
if (disk_ioctl(pdrv, GET_SECTOR_COUNT, &sz_disk)) return FR_DISK_ERR;
|
||||
|
||||
/* Determine the CHS without any care of the drive geometry */
|
||||
- for (n = 16; n < 256 && sz_disk / n / 63 > 1024; n *= 2) ;
|
||||
+ for (n = 16; n < 256 && sz_disk / n / 63 > 1024; n *= 2) {} ;
|
||||
if (n == 256) n--;
|
||||
e_hd = n - 1;
|
||||
sz_cyl = 63 * n;
|
||||
@@ -5991,7 +5991,7 @@
|
||||
switch (d) { /* Type is... */
|
||||
case 'S' : /* String */
|
||||
p = va_arg(arp, TCHAR*);
|
||||
- for (j = 0; p[j]; j++) ;
|
||||
+ for (j = 0; p[j]; j++) {} ;
|
||||
if (!(f & 2)) {
|
||||
while (j++ < w) putc_bfd(&pb, ' ');
|
||||
}
|
||||
@ -1,5 +0,0 @@
|
||||
17a18,19
|
||||
> /* removed because it creates a naming clash with cc2538_rfcore.h
|
||||
> * and it isn't used anyway
|
||||
18a21
|
||||
> */
|
||||
@ -1,11 +0,0 @@
|
||||
--- ffconf.h 2016-10-14 16:11:35.060659327 +0200
|
||||
+++ ffconf_patched.h 2016-10-17 12:16:11.967672504 +0200
|
||||
@@ -69,7 +69,7 @@
|
||||
/ Locale and Namespace Configurations
|
||||
/---------------------------------------------------------------------------*/
|
||||
|
||||
-#define _CODE_PAGE 932
|
||||
+#define _CODE_PAGE 1
|
||||
/* This option specifies the OEM code page to be used on the target system.
|
||||
/ Incorrect setting of the code page can cause a file open failure.
|
||||
/
|
||||
@ -18,9 +18,10 @@
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef FATFS_RTC_AVAILABLE
|
||||
#if FATFS_FFCONF_OPT_FS_NORTC == 0
|
||||
#include "periph/rtc.h"
|
||||
#endif
|
||||
#include "fatfs_diskio_common.h"
|
||||
#include "fatfs/ff.h"
|
||||
#include "shell.h"
|
||||
#include <string.h>
|
||||
@ -29,7 +30,6 @@
|
||||
#include <inttypes.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#define TEST_FATFS_RTC_YEAR_OFFSET 1900
|
||||
#define TEST_FATFS_READ_BUFFER_SIZE 64
|
||||
#define TEST_FATFS_MAX_LBL_SIZE 64
|
||||
#define TEST_FATFS_MAX_VOL_STR_LEN 8
|
||||
@ -350,7 +350,7 @@ static const shell_command_t shell_commands[] = {
|
||||
|
||||
int main(void)
|
||||
{
|
||||
#ifdef FATFS_RTC_AVAILABLE
|
||||
#if FATFS_FFCONF_OPT_FS_NORTC == 0
|
||||
/* the rtc is used in diskio.c for timestamps of files */
|
||||
puts("Initializing the RTC driver");
|
||||
rtc_poweron();
|
||||
@ -366,7 +366,7 @@ int main(void)
|
||||
|
||||
printf("Setting RTC to %04d-%02d-%02d %02d:%02d:%02d\n",
|
||||
time.tm_year + RTC_YEAR_OFFSET,
|
||||
time.tm_mon + RTC_MON_OFFSET,
|
||||
time.tm_mon + TEST_FATFS_RTC_MON_OFFSET,
|
||||
time.tm_mday,
|
||||
time.tm_hour,
|
||||
time.tm_min,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user