You've already forked Core2forAWS-MicroPython
mirror of
https://github.com/m5stack/Core2forAWS-MicroPython.git
synced 2026-05-20 10:30:31 -07:00
stmhal: Upgrade to latest fatfs driver.
This commit is contained in:
+5
-9
@@ -21,7 +21,7 @@ CMSIS_DIR=cmsis
|
||||
HAL_DIR=hal
|
||||
USBDEV_DIR=usbdev
|
||||
#USBHOST_DIR=usbhost
|
||||
FATFS_DIR=fatfs
|
||||
FATFS_DIR=lib/fatfs
|
||||
DFU=../tools/dfu.py
|
||||
# may need to prefix dfu-util with sudo
|
||||
USE_PYDFU ?= 0
|
||||
@@ -40,7 +40,7 @@ INC += -I$(CMSIS_DIR)/devinc
|
||||
INC += -I$(HAL_DIR)/inc
|
||||
INC += -I$(USBDEV_DIR)/core/inc -I$(USBDEV_DIR)/class/cdc_msc_hid/inc
|
||||
#INC += -I$(USBHOST_DIR)
|
||||
INC += -I$(FATFS_DIR)/src
|
||||
INC += -I../$(FATFS_DIR)
|
||||
|
||||
CFLAGS_CORTEX_M4 = -mthumb -mtune=cortex-m4 -mabi=aapcs-linux -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -fsingle-precision-constant -Wdouble-promotion
|
||||
CFLAGS = $(INC) -Wall -Wpointer-arith -Werror -ansi -std=gnu99 -nostdlib $(CFLAGS_MOD) $(CFLAGS_CORTEX_M4) $(COPT)
|
||||
@@ -81,6 +81,8 @@ SRC_LIB = $(addprefix lib/,\
|
||||
libm/sf_sin.c \
|
||||
libm/sf_cos.c \
|
||||
libm/sf_tan.c \
|
||||
fatfs/ff.c \
|
||||
fatfs/option/ccsbcs.c \
|
||||
)
|
||||
|
||||
SRC_C = \
|
||||
@@ -199,11 +201,6 @@ SRC_USBDEV = $(addprefix $(USBDEV_DIR)/,\
|
||||
usbd_storage_msd.c \
|
||||
)
|
||||
|
||||
SRC_FATFS = $(addprefix $(FATFS_DIR)/src/,\
|
||||
ff.c \
|
||||
option/ccsbcs.c \
|
||||
)
|
||||
|
||||
ifeq ($(MICROPY_PY_WIZNET5K),1)
|
||||
WIZNET5K_DIR=drivers/wiznet5k
|
||||
INC += -I$(TOP)/$(WIZNET5K_DIR)
|
||||
@@ -247,7 +244,6 @@ OBJ += $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
|
||||
OBJ += $(addprefix $(BUILD)/, $(SRC_S:.s=.o))
|
||||
OBJ += $(addprefix $(BUILD)/, $(SRC_HAL:.c=.o))
|
||||
OBJ += $(addprefix $(BUILD)/, $(SRC_USBDEV:.c=.o))
|
||||
OBJ += $(addprefix $(BUILD)/, $(SRC_FATFS:.c=.o))
|
||||
OBJ += $(addprefix $(BUILD)/, $(SRC_MOD:.c=.o))
|
||||
OBJ += $(BUILD)/pins_$(BOARD).o
|
||||
|
||||
@@ -255,7 +251,7 @@ OBJ += $(BUILD)/pins_$(BOARD).o
|
||||
# If we compile these using -O0 then it won't fit. So if you really want these
|
||||
# to be compiled with -O0, then edit stm32f405.ld (in the .isr_vector section)
|
||||
# and comment out the following 2 lines.
|
||||
$(BUILD)/$(FATFS_DIR)/src/ff.o: COPT += -Os
|
||||
$(BUILD)/$(FATFS_DIR)/ff.o: COPT += -Os
|
||||
$(BUILD)/$(HAL_DIR)/src/stm32f4xx_hal_sd.o: COPT += -Os
|
||||
|
||||
all: $(BUILD)/firmware.dfu $(BUILD)/firmware.hex
|
||||
|
||||
-114
@@ -1,114 +0,0 @@
|
||||
/*
|
||||
* This file is part of the Micro Python project, http://micropython.org/
|
||||
*
|
||||
* Original file from: Low level disk interface modlue include file, (C)ChaN, 2013
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2013, 2014 Damien P. George
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _DISKIO_DEFINED
|
||||
#define _DISKIO_DEFINED
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define _USE_WRITE 1 /* 1: Enable disk_write function */
|
||||
#define _USE_IOCTL 1 /* 1: Enable disk_ioctl fucntion */
|
||||
|
||||
#include "integer.h"
|
||||
|
||||
|
||||
/* Status of Disk Functions */
|
||||
typedef BYTE DSTATUS;
|
||||
|
||||
/* Results of Disk Functions */
|
||||
typedef enum {
|
||||
RES_OK = 0, /* 0: Successful */
|
||||
RES_ERROR, /* 1: R/W Error */
|
||||
RES_WRPRT, /* 2: Write Protected */
|
||||
RES_NOTRDY, /* 3: Not Ready */
|
||||
RES_PARERR /* 4: Invalid Parameter */
|
||||
} DRESULT;
|
||||
|
||||
|
||||
/*---------------------------------------*/
|
||||
/* Prototypes for disk control functions */
|
||||
|
||||
|
||||
DSTATUS disk_initialize (BYTE pdrv);
|
||||
DSTATUS disk_status (BYTE pdrv);
|
||||
DRESULT disk_read (BYTE pdrv, BYTE*buff, DWORD sector, UINT count);
|
||||
DRESULT disk_write (BYTE pdrv, const BYTE* buff, DWORD sector, UINT count);
|
||||
DRESULT disk_ioctl (BYTE pdrv, BYTE cmd, void* buff);
|
||||
|
||||
DWORD get_fattime (void);
|
||||
|
||||
/* Disk Status Bits (DSTATUS) */
|
||||
#define STA_NOINIT 0x01 /* Drive not initialized */
|
||||
#define STA_NODISK 0x02 /* No medium in the drive */
|
||||
#define STA_PROTECT 0x04 /* Write protected */
|
||||
|
||||
|
||||
/* Command code for disk_ioctrl fucntion */
|
||||
|
||||
/* Generic command (used by FatFs) */
|
||||
#define CTRL_SYNC 0 /* Flush disk cache (for write functions) */
|
||||
#define GET_SECTOR_COUNT 1 /* Get media size (for only f_mkfs()) */
|
||||
#define GET_SECTOR_SIZE 2 /* Get sector size (for multiple sector size (_MAX_SS >= 1024)) */
|
||||
#define GET_BLOCK_SIZE 3 /* Get erase block size (for only f_mkfs()) */
|
||||
#define CTRL_ERASE_SECTOR 4 /* Force erased a block of sectors (for only _USE_ERASE) */
|
||||
|
||||
/* Generic command (not used by FatFs) */
|
||||
#define CTRL_POWER 5 /* Get/Set power status */
|
||||
#define CTRL_LOCK 6 /* Lock/Unlock media removal */
|
||||
#define CTRL_EJECT 7 /* Eject media */
|
||||
#define CTRL_FORMAT 8 /* Create physical format on the media */
|
||||
|
||||
/* MMC/SDC specific ioctl command */
|
||||
#define MMC_GET_TYPE 10 /* Get card type */
|
||||
#define MMC_GET_CSD 11 /* Get CSD */
|
||||
#define MMC_GET_CID 12 /* Get CID */
|
||||
#define MMC_GET_OCR 13 /* Get OCR */
|
||||
#define MMC_GET_SDSTAT 14 /* Get SD status */
|
||||
|
||||
/* ATA/CF specific ioctl command */
|
||||
#define ATA_GET_REV 20 /* Get F/W revision */
|
||||
#define ATA_GET_MODEL 21 /* Get model name */
|
||||
#define ATA_GET_SN 22 /* Get serial number */
|
||||
|
||||
|
||||
/* MMC card type flags (MMC_GET_TYPE) */
|
||||
#define CT_MMC 0x01 /* MMC ver 3 */
|
||||
#define CT_SD1 0x02 /* SD ver 1 */
|
||||
#define CT_SD2 0x04 /* SD ver 2 */
|
||||
#define CT_SDC (CT_SD1|CT_SD2) /* SD */
|
||||
#define CT_BLOCK 0x08 /* Block addressing */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,118 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
<meta name="description" content="Open source FAT file system module for embedded projects">
|
||||
<link rel="start" title="Site Top" href="../../">
|
||||
<link rel="up" title="Freewares" href="../../fsw_e.html">
|
||||
<link rel="alternate" hreflang="ja" title="Japanese version" href="00index_j.html">
|
||||
<link rel="stylesheet" href="css_e.css" type="text/css" media="screen" title="ELM Default">
|
||||
<title>FatFs - Generic FAT File System Module</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>FatFs - Generic FAT File System Module</h1>
|
||||
<hr>
|
||||
|
||||
<div class="abst">
|
||||
<img src="img/layers.png" class="rset" width="245" height="255" alt="layer">
|
||||
<p>FatFs is a generic FAT file system module for small embedded systems. The FatFs is written in compliance with ANSI C and completely separated from the disk I/O layer. Therefore it is independent of hardware architecture. It can be incorporated into low cost microcontrollers, such as AVR, 8051, PIC, ARM, Z80, 68k and etc..., without any change. Petit FatFs module is also available <a href="http://elm-chan.org/fsw/ff/00index_p.html">here</a>.</p>
|
||||
|
||||
<h4>Features</h4>
|
||||
<ul>
|
||||
<li>Windows compatible FAT file system.</li>
|
||||
<li>Platform independent. Easy to port.</li>
|
||||
<li>Very small footprint for code and work area.</li>
|
||||
<li>Various configuration options:
|
||||
<ul>
|
||||
<li>Multiple volumes (physical drives and partitions).</li>
|
||||
<li>Multiple ANSI/OEM code pages including DBCS.</li>
|
||||
<li>Long file name support in ANSI/OEM or Unicode.</li>
|
||||
<li>RTOS support.</li>
|
||||
<li>Multiple sector size support.</li>
|
||||
<li>Read-only, minimized API, I/O buffer and etc...</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="para">
|
||||
<h3>Application Interface</h3>
|
||||
<p>FatFs module provides following functions to the applications. In other words, this list describes what FatFs can do to access the FAT volumes.</p>
|
||||
<ul>
|
||||
<li><a href="en/open.html">f_open</a> - Open/Create a file</li>
|
||||
<li><a href="en/close.html">f_close</a> - Close an open file</li>
|
||||
<li><a href="en/read.html">f_read</a> - Read file</li>
|
||||
<li><a href="en/write.html">f_write</a> - Write file</li>
|
||||
<li><a href="en/lseek.html">f_lseek</a> - Move read/write pointer, Expand file size</li>
|
||||
<li><a href="en/truncate.html">f_truncate</a> - Truncate file size</li>
|
||||
<li><a href="en/sync.html">f_sync</a> - Flush cached data</li>
|
||||
<li><a href="en/forward.html">f_forward</a> - Forward file data to the stream</li>
|
||||
<li><a href="en/stat.html">f_stat</a> - Check existance of a file or sub-directory</li>
|
||||
<li><a href="en/opendir.html">f_opendir</a> - Open a directory</li>
|
||||
<li><a href="en/closedir.html">f_closedir</a> - Close an open directory</li>
|
||||
<li><a href="en/readdir.html">f_readdir</a> - Read a directory item</li>
|
||||
<li><a href="en/mkdir.html">f_mkdir</a> - Create a sub-directory</li>
|
||||
<li><a href="en/unlink.html">f_unlink</a> - Remove a file or sub-directory</li>
|
||||
<li><a href="en/chmod.html">f_chmod</a> - Change attribute</li>
|
||||
<li><a href="en/utime.html">f_utime</a> - Change timestamp</li>
|
||||
<li><a href="en/rename.html">f_rename</a> - Rename/Move a file or sub-directory</li>
|
||||
<li><a href="en/chdir.html">f_chdir</a> - Change current directory</li>
|
||||
<li><a href="en/chdrive.html">f_chdrive</a> - Change current drive</li>
|
||||
<li><a href="en/getcwd.html">f_getcwd</a> - Retrieve the current directory</li>
|
||||
<li><a href="en/getfree.html">f_getfree</a> - Get free clusters</li>
|
||||
<li><a href="en/getlabel.html">f_getlabel</a> - Get volume label</li>
|
||||
<li><a href="en/setlabel.html">f_setlabel</a> - Set volume label</li>
|
||||
<li><a href="en/mount.html">f_mount</a> - Register/Unregister a work area</li>
|
||||
<li><a href="en/mkfs.html">f_mkfs</a> - Create a file system on the drive</li>
|
||||
<li><a href="en/fdisk.html">f_fdisk</a> - Divide a physical drive</li>
|
||||
<li><a href="en/gets.html">f_gets</a> - Read a string</li>
|
||||
<li><a href="en/putc.html">f_putc</a> - Write a character</li>
|
||||
<li><a href="en/puts.html">f_puts</a> - Write a string</li>
|
||||
<li><a href="en/printf.html">f_printf</a> - Write a formatted string</li>
|
||||
<li><a href="en/tell.html">f_tell</a> - Get current read/write pointer</li>
|
||||
<li><a href="en/eof.html">f_eof</a> - Test for end-of-file on a file</li>
|
||||
<li><a href="en/size.html">f_size</a> - Get size of a file</li>
|
||||
<li><a href="en/error.html">f_error</a> - Test for an error on a file</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="para">
|
||||
<h3>Disk I/O Interface</h3>
|
||||
<p>Since the FatFs module is completely separated from disk I/O layer, it requires following functions to access the physical media. When O/S related feature is enabled, it will require process/memory functions in addition. However the low level disk I/O module is not a part of FatFs module, so that it must be provided by user. The sample implementations are also available in the downloads.</p>
|
||||
<ul>
|
||||
<li><a href="en/dinit.html">disk_initialize</a> - Initialize disk drive</li>
|
||||
<li><a href="en/dstat.html">disk_status</a> - Get disk status</li>
|
||||
<li><a href="en/dread.html">disk_read</a> - Read sector(s)</li>
|
||||
<li><a href="en/dwrite.html">disk_write</a> - Write sector(s)</li>
|
||||
<li><a href="en/dioctl.html">disk_ioctl</a> - Control device dependent features</li>
|
||||
<li><a href="en/fattime.html">get_fattime</a> - Get current time</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="para">
|
||||
<h3>Resources</h3>
|
||||
<p>The FatFs module is a free software opened for education, research and development. You can use, modify and/or redistribute it for personal projects or commercial products without any restriction under your responsibility. For further information, refer to the application note.</p>
|
||||
<ul>
|
||||
<li><a href="http://elm-chan.org/fsw/ff/bd/"><em>FatFs User Forum</em></a></li>
|
||||
<li>Read first: <a href="en/appnote.html">FatFs module application note</a> <span class="mfd">October 2, 2013</span></li>
|
||||
<li><a href="http://nemuisan.blog.bai.ne.jp/">Nemuisan's Blog</a> (Well written implementations for STM32F/SDIO and LPC2300/MCI)</li>
|
||||
<li><a href="http://www.siwawi.arubi.uni-kl.de/avr_projects/arm_projects/arm_memcards/index.html">ARM-Projects by Martin THOMAS</a> (Examples for LPC2000, AT91SAM and STM32)</li>
|
||||
<li><a href="http://www.microsoft.com/whdc/system/platform/firmware/fatgen.mspx">FAT32 Specification by Microsoft</a> (The reference document on FAT file system)</li>
|
||||
<li><a href="http://elm-chan.org/docs/fat.html">The basics of FAT file system [ja]</a></li>
|
||||
<li><a href="http://elm-chan.org/docs/mmc/mmc_e.html">How to Use MMC/SDC</a></li>
|
||||
<li><a href="img/rwtest.png">Benchmark 1</a> (ATmega64/9.2MHz with MMC via SPI, HDD/CFC via GPIO)</li>
|
||||
<li><a href="img/rwtest2.png">Benchmark 2</a> (LPC2368/72MHz with MMC via MCI)</li>
|
||||
<li><a href="http://members.jcom.home.ne.jp/felm/fd.mp4">Demo movie of an application</a> (this project is in ffsample.zip/lpc23xx)</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
<hr>
|
||||
<p class="foot"><a href="../../fsw_e.html">Return</a></p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,116 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html lang="ja">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
<meta name="description" content="組み込みシステム向け汎用FATファイル・システム">
|
||||
<link rel="start" title="Site Top" href="../../index_j.html">
|
||||
<link rel="up" title="Freewares" href="../../fsw.html">
|
||||
<link rel="alternate" hreflang="en" title="英文" href="00index_e.html">
|
||||
<link rel="stylesheet" href="css_j.css" type="text/css" media="screen" title="ELM Default">
|
||||
<title>FatFs 汎用FATファイルシステム・モジュール</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>FatFs 汎用FATファイルシステム・モジュール</h1>
|
||||
<hr>
|
||||
|
||||
<div class="abst">
|
||||
<img src="img/layers.png" class="rset" width="245" height="255" alt="layer">
|
||||
<p>FatFsは小規模な組み込みシステム向けの汎用FATファイルシステム・モジュールです。ANSI C準拠でハードウェア・アーキテクチャには依存しないので、必要なワーク・エリアが確保できれば、8051, PIC, AVR, SH, Z80, 68k, H8, ARMなど安価なマイコンでも使用可能です。FatFsをシュリンクした<a href="http://elm-chan.org/fsw/ff/00index_p.html">ぷちFatFs</a>もあります。</p>
|
||||
<h4>FatFsモジュールの特徴</h4>
|
||||
<ul>
|
||||
<li>Windows互換 FATファイル・システム</li>
|
||||
<li>プラットフォーム非依存</li>
|
||||
<li>コンパクトなコードとRAM使用量</li>
|
||||
<li>多くの構成オプション:
|
||||
<ul>
|
||||
<li>複数のボリューム(物理ドライブ・区画)</li>
|
||||
<li>DBCSを含む複数のANSI/OEMコード・ページ</li>
|
||||
<li>長いファイル名(LFN) (Unicode APIも選択可)</li>
|
||||
<li>マルチタスク関連</li>
|
||||
<li>マルチ・セクタ・サイズ</li>
|
||||
<li>リード・オンリー構成、一部APIの削除、バッファ構成、その他…</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="para">
|
||||
<h3>上位レイヤ・インターフェース</h3>
|
||||
<p>FatFsモジュールは、アプリケーション・レイヤに対し、次のファイル操作関数(API)を提供します。つまり、このリストはFatFsにできることをシンプルに示しています。</p>
|
||||
<ul>
|
||||
<li><a href="ja/open.html">f_open</a> - ファイルのオープン・作成</li>
|
||||
<li><a href="ja/close.html">f_close</a> - ファイルのクローズ</li>
|
||||
<li><a href="ja/read.html">f_read</a> - ファイルの読み出し</li>
|
||||
<li><a href="ja/write.html">f_write</a> - ファイルの書き込み</li>
|
||||
<li><a href="ja/lseek.html">f_lseek</a> - リード/ライト・ポインタの移動, ファイルの拡張</li>
|
||||
<li><a href="ja/truncate.html">f_truncate</a> - ファイル・サイズの切り詰め</li>
|
||||
<li><a href="ja/sync.html">f_sync</a> - キャッシュされたデータのフラッシュ</li>
|
||||
<li><a href="ja/forward.html">f_forward</a> - ファイル・データをストリーム関数に転送</li>
|
||||
<li><a href="ja/stat.html">f_stat</a> - ファイル/サブディレクトリの存在チェックと情報の取得</li>
|
||||
<li><a href="ja/opendir.html">f_opendir</a> - ディレクトリのオープン</li>
|
||||
<li><a href="ja/closedir.html">f_closedir</a> - ディレクトリのクローズ</li>
|
||||
<li><a href="ja/readdir.html">f_readdir</a> - ディレクトリの読み出し</li>
|
||||
<li><a href="ja/mkdir.html">f_mkdir</a> - サブディレクトリの作成</li>
|
||||
<li><a href="ja/unlink.html">f_unlink</a> - ファイル/サブディレクトリの削除</li>
|
||||
<li><a href="ja/chmod.html">f_chmod</a> - ファイル/サブディレクトリの属性の変更</li>
|
||||
<li><a href="ja/utime.html">f_utime</a> - ファイル/サブディレクトリのタイムスタンプの変更</li>
|
||||
<li><a href="ja/rename.html">f_rename</a> - ファイル/サブディレクトリの名前変更・移動</li>
|
||||
<li><a href="ja/chdir.html">f_chdir</a> - カレント・ディレクトリの変更</li>
|
||||
<li><a href="ja/chdrive.html">f_chdrive</a> - カレント・ドライブの変更</li>
|
||||
<li><a href="ja/getcwd.html">f_getcwd</a> - カレント・ディレクトリの取得</li>
|
||||
<li><a href="ja/getfree.html">f_getfree</a> - ボリューム空き領域の取得</li>
|
||||
<li><a href="ja/getlabel.html">f_getlabel</a> - ボリューム・ラベルの取得</li>
|
||||
<li><a href="ja/setlabel.html">f_setlabel</a> - ボリューム・ラベルの設定</li>
|
||||
<li><a href="ja/mount.html">f_mount</a> - ワークエリアの登録・削除</li>
|
||||
<li><a href="ja/mkfs.html">f_mkfs</a> - 論理ドライブのフォーマット</li>
|
||||
<li><a href="ja/fdisk.html">f_fdisk</a> - 物理ドライブの分割</li>
|
||||
<li><a href="ja/gets.html">f_gets</a> - 文字列の読み出し</li>
|
||||
<li><a href="ja/putc.html">f_putc</a> - 文字の書き込み</li>
|
||||
<li><a href="ja/puts.html">f_puts</a> - 文字列の書き込み</li>
|
||||
<li><a href="ja/printf.html">f_printf</a> - 書式化文字列の書き込み</li>
|
||||
<li><a href="ja/tell.html">f_tell</a> - 現在のリード/ライト・ポインタの取得</li>
|
||||
<li><a href="ja/eof.html">f_eof</a> - ファイル終端の有無の取得</li>
|
||||
<li><a href="ja/size.html">f_size</a> - ファイル・サイズの取得</li>
|
||||
<li><a href="ja/error.html">f_error</a> - ファイルのエラーの有無の取得</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="para">
|
||||
<h3>下位レイヤ・インターフェース</h3>
|
||||
<p>FatFsモジュールは、単なるファイル・システム・レイヤなので、メディア制御レイヤは含まれません。使用するメディアに対応した制御関数は、ユーザによって提供される必要があります。FatFsモジュールは、下位レイヤに対し少なくとも次のインターフェースを要求します。OS関連機能を有効にしたときは、加えてプロセス/メモリ関連関数も必要になります。サンプル・プロジェクトに下位レイヤの実装例を示します。</p>
|
||||
<ul>
|
||||
<li><a href="ja/dinit.html">disk_initialize</a> - ドライブの初期化</li>
|
||||
<li><a href="ja/dstat.html">disk_status</a> - ドライブの状態取得</li>
|
||||
<li><a href="ja/dread.html">disk_read</a> - データの読み出し</li>
|
||||
<li><a href="ja/dwrite.html">disk_write</a> - データの書き込み</li>
|
||||
<li><a href="ja/dioctl.html">disk_ioctl</a> - その他のドライブ制御</li>
|
||||
<li><a href="ja/fattime.html">get_fattime</a> - 日付・時刻の取得</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="para">
|
||||
<h3>資料</h3>
|
||||
<p>FatFsモジュールはフリー・ソフトウェアとして教育・研究・開発用に公開しています。どのような利用目的(個人利用から商用まで)でも使用・改変・配布について一切の制限はありませんが、全て利用者の責任の下での利用とします。詳しくはアプリケーション・ノートを参照してください。</p>
|
||||
<ul>
|
||||
<li><a href="http://elm-chan.org/fsw/ff/bd/"><em>FatFsユーザ・フォーラム</em></a></li>
|
||||
<li>最初に読め: <a href="ja/appnote.html">FatFsモジュール・アプリケーション・ノート</a> <span class="mfd">2013. 10. 2</span></li>
|
||||
<li><a href="http://nemuisan.blog.bai.ne.jp/">ねむいさんのぶろぐ</a> (Well written implementations for STM32F/SDIO and LPC2300/MCI)</li>
|
||||
<li><a href="http://www.siwawi.arubi.uni-kl.de/avr_projects/arm_projects/arm_memcards/index.html">ARM-Projects by Martin THOMAS</a> (Examples for LPC2000, AT91SAM and STM32)</li>
|
||||
<li><a href="http://www.microsoft.com/whdc/system/platform/firmware/fatgen.mspx">FATファイル・システム仕様書 by Microsoft</a> (The reference document on FAT file system)</li>
|
||||
<li><a href="http://elm-chan.org/docs/fat.html">FATファイル・システム概要</a> (↑を読むためのガイド)</li>
|
||||
<li><a href="http://elm-chan.org/docs/mmc/mmc.html">MMCの使いかた</a></li>
|
||||
<li><a href="img/rwtest.png">パフォーマンス・テスト1</a> (ATmega64/9.2MHz with MMC via SPI, HDD/CFC via GPIO)</li>
|
||||
<li><a href="img/rwtest2.png">パフォーマンス・テスト2</a> (LPC2368/72MHz with MMC via MCI)</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
<hr>
|
||||
<p class="foot"><a href="../../fsw.html">戻る</a></p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,60 +0,0 @@
|
||||
* {margin: 0; padding: 0; border-width: 0;}
|
||||
body {margin: 8px; background-color: #e0ffff; font-color: black; font-family: serif; line-height: 133%; max-width: 1024px;}
|
||||
a:link {color: blue;}
|
||||
a:visited {color: darkmagenta;}
|
||||
a:hover {background-color: #a0ffff;}
|
||||
a:active {color: darkmagenta; overflow: hidden; outline:none; position: relative; top: 1px; left: 1px;}
|
||||
abbr {border-width: 1px;}
|
||||
|
||||
p {margin: 0 0 0.3em 1em;}
|
||||
em {font-style: normal; font-weight: bold; margin: 0 0.1em;}
|
||||
strong {}
|
||||
pre {border: 1px dashed gray; margin: 0.5em 1em; padding: 0.5em; line-height: 1.2em; font-size: 85%; font-family: "Consolas", "Courier New", monospace; background-color: white;}
|
||||
pre span.c {color: green;}
|
||||
pre span.k {color: blue;}
|
||||
pre span.arg {font-style: italic;}
|
||||
tt {margin: 0 0.2em; font-size: 0.85em; font-family: "Consolas", "Courier New", monospace; }
|
||||
tt.arg {font-style: italic;}
|
||||
ol {margin: 0.5em 2.5em;}
|
||||
ul {margin: 0.5em 2em;}
|
||||
dl {margin: 0.5em 1em;}
|
||||
dd {margin: 0 2em;}
|
||||
dt {font-size: 0.85em; font-family: "Consolas", "Courier New", monospace;}
|
||||
dl.par dt {margin: 0.5em 0 0 0 ; font-style: italic; }
|
||||
dl.ret dt {margin: 0.5em 0 0 0 ; font-size: 0.85em; font-family: "Consolas", "Courier New", monospace;}
|
||||
hr {border-width: 1px; margin: 1em;}
|
||||
div.abst {font-family: sans-serif;}
|
||||
div.para {clear: both; font-family: serif;}
|
||||
div.ret a {font-size: 0.85em; font-family: "Consolas", "Courier New", monospace; }
|
||||
.equ {text-indent: 0; margin: 1em 2em 1em;}
|
||||
.indent {margin-left: 2em;}
|
||||
.rset {float: right; margin: 0 0 0.5em 0.5em;}
|
||||
.lset {float: left; margin: 0 0.5em 0.5em 0.5em;}
|
||||
ul.flat li {list-style-type: none; margin: 0;}
|
||||
a.imglnk img {border: 1px solid;}
|
||||
.iequ {white-space: nowrap; font-weight: bold;}
|
||||
.clr {clear: both;}
|
||||
.it {font-style: italic;}
|
||||
.mfd {font-size: 0.7em; padding: 0 1px; border: 1px solid; white-space : nowrap}
|
||||
|
||||
h1 {line-height: 1em; font-size: 2em; font-family: sans-serif; padding: 0.3em 0 0.3em;}
|
||||
p.hdd {float: right; text-align: right; margin-top: 0.5em;}
|
||||
hr.hds {clear: both; margin-bottom: 1em;}
|
||||
|
||||
h2 {font-size: 2em; font-family: sans-serif; background-color: #d8d8FF; padding: 0.5em 0.5em; margin: 0 0 0.5em;}
|
||||
h3 {font-size: 1.5em; font-family: sans-serif; margin: 1.5em 0 0.5em;}
|
||||
h4 {font-size: 1.2em; font-family: sans-serif; margin: 1em 0 0.2em;}
|
||||
h5 {font-size: 1em; font-family: sans-serif; margin: 0.5em 0 0em;}
|
||||
small {font-size: 80%;}
|
||||
.indent {margin-left: 2em;}
|
||||
|
||||
/* Tables */
|
||||
table {margin: 0.5em 1em; border-collapse: collapse; border: 2px solid black; }
|
||||
th {background-color: white; border-style: solid; border-width: 1px 1px 2px; border-color: black; padding: 0 3px; vertical-align: top; white-space: nowrap;}
|
||||
td {background-color: white; border: 1px solid black; padding: 0 3px; vertical-align: top; line-height: 1.3em;}
|
||||
table.lst td:first-child {font-size: 0.85em; font-family: "Consolas", "Courier New", monospace;}
|
||||
table.lst2 td {font-size: 0.85em; font-family: "Consolas", "Courier New", monospace;}
|
||||
table caption {font-family: sans-serif; font-weight: bold;}
|
||||
tr.lst3 td { border-width: 2px 1px 1px; }
|
||||
|
||||
p.foot {clear: both; text-indent: 0; margin: 1em 0.5em 1em;}
|
||||
@@ -1,63 +0,0 @@
|
||||
@charset "Shift_JIS";
|
||||
/* Common style sheet for Tech Notes */
|
||||
|
||||
* {margin: 0; padding: 0; border-width: 0;}
|
||||
body {margin: 8px; background-color: #e0ffff; font-color: black; font-family:"MS P明朝", serif; line-height: 150%; letter-spacing: 1px; max-width: 1024px;}
|
||||
a:link {color: blue;}
|
||||
a:visited {color: darkmagenta;}
|
||||
a:hover {background-color: #a0ffff;}
|
||||
a:active {color: darkmagenta; overflow: hidden; outline:none; position: relative; top: 1px; left: 1px;}
|
||||
abbr {border-width: 1px;}
|
||||
|
||||
p {text-indent: 1em; margin: 0 0 0.3em 0.5em;}
|
||||
em {font-style: normal; font-weight: bold; margin: 0 0.1em;}
|
||||
strong {}
|
||||
pre {border: 1px dashed gray; margin: 0.5em 1em; padding: 0.5em; line-height: 1.2em; letter-spacing: 0; font-size: 0.85em; font-family: "Consolas", "Courier New", "MS ゴシック", monospace; background-color: white;}
|
||||
pre span.c {color: green;}
|
||||
pre span.k {color: blue;}
|
||||
pre span.arg {font-style: italic;}
|
||||
tt {margin: 0 0.2em; letter-spacing: 0; font-size: 0.85em; font-family: "Consolas", "Courier New", "MS ゴシック", monospace;}
|
||||
tt.arg {font-style: italic;}
|
||||
ol {margin: 0.5em 2.5em;}
|
||||
ul {margin: 0.5em 2em;}
|
||||
dl {margin: 0.5em 1em;}
|
||||
dd {margin: 0em 2em;}
|
||||
dt {font-size: 0.85em; font-family: "Consolas", "Courier New", "MS ゴシック", monospace;}
|
||||
dl.par dt {margin: 0.5em 0 0 0 ; font-style: italic; letter-spacing: 0;}
|
||||
dl.ret dt {margin: 0.5em 0 0 0 ; font-size: 0.85em; font-family: "Consolas", "Courier New", "MS ゴシック", monospace; letter-spacing: 0; }
|
||||
hr {border-width: 1px; margin: 1em;}
|
||||
div.abst {font-family: "MS Pゴシック",sans-serif;}
|
||||
div.para {clear: both; font-family: "MS P明朝",serif;}
|
||||
div.ret a {font-size: 0.85em; font-family: "Consolas", "Courier New", monospace; }
|
||||
.equ {text-indent: 0; margin: 1em 2em 1em;}
|
||||
.indent {margin-left: 2em;}
|
||||
.rset {float: right; margin: 0 0 0.5em 0.5em;}
|
||||
.lset {float: left; margin: 0 0.5em 0.5em 0.5em;}
|
||||
ul.flat li {list-style-type: none; margin: 0;}
|
||||
a.imglnk img {border: 1px solid;}
|
||||
.iequ {white-space: nowrap; font-weight: bold;}
|
||||
.clr {clear: both;}
|
||||
.it {font-style: italic;}
|
||||
.mfd {font-size: 0.7em; padding: 0 1px; border: 1px solid; white-space : nowrap}
|
||||
|
||||
h1 {line-height: 1em; font-size: 2em; font-family: sans-serif; padding: 0.3em 0 0.3em;}
|
||||
p.hdd {float: right; text-align: right; margin-top: 0.5em;}
|
||||
hr.hds {clear: both; margin-bottom: 1em;}
|
||||
|
||||
h2 {font-size: 2em; font-family: "MS Pゴシック",sans-serif; background-color: #d8d8FF; padding: 0.5em 0.5em; margin: 0 0 0.5em;}
|
||||
h3 {font-size: 1.5em; font-family: "MS Pゴシック",sans-serif; margin: 1.5em 0 0.5em;}
|
||||
h4 {font-size: 1.2em; font-family: "MS Pゴシック",sans-serif; margin: 1em 0 0.2em;}
|
||||
h5 {font-size: 1em; font-family: "MS Pゴシック",sans-serif; margin: 0.5em 0 0em;}
|
||||
small {font-size: 80%;}
|
||||
.indent {margin-left: 2em;}
|
||||
|
||||
/* Tables */
|
||||
table {margin: 0.5em 1em; border-collapse: collapse; border: 2px solid black; letter-spacing: 0;}
|
||||
th {background-color: white; border-style: solid; border-width: 1px 1px 2px; border-color: black; padding: 0 3px; vertical-align: top;}
|
||||
td {background-color: white; border: 1px solid black; padding: 0 3px; vertical-align: top; line-height: 1.3em;}
|
||||
table.lst td:first-child {font-size: 0.85em; font-family: "Consolas", "Courier New", monospace; white-space: nowrap;}
|
||||
table.lst2 td {font-size: 0.85em; font-family: "Consolas", "Courier New", monospace; white-space: nowrap;}
|
||||
table caption {font-family: sans-serif; font-weight: bold;}
|
||||
tr.lst3 td {border-width: 2px 1px 1px; }
|
||||
|
||||
p.foot {clear: both; text-indent: 0; margin: 1em 0.5em 1em;}
|
||||
@@ -1,271 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
<link rel="up" title="FatFs" href="../00index_e.html">
|
||||
<link rel="alternate" hreflang="ja" title="Japanese" href="../ja/appnote.html">
|
||||
<link rel="stylesheet" href="../css_e.css" type="text/css" media="screen" title="ELM Default">
|
||||
<title>FatFs Module Application Note</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>FatFs Module Application Note</h1>
|
||||
<ol class="toc">
|
||||
<li><a href="#port">How to Port</a></li>
|
||||
<li><a href="#limits">Limits</a></li>
|
||||
<li><a href="#memory">Memory Usage</a></li>
|
||||
<li><a href="#reduce">Module Size Reduction</a></li>
|
||||
<li><a href="#lfn">Long File Name</a></li>
|
||||
<li><a href="#unicode">Unicode API</a></li>
|
||||
<li><a href="#reentrant">Re-entrancy</a></li>
|
||||
<li><a href="#dup">Duplicated File Access</a></li>
|
||||
<li><a href="#fs1">Performance Effective File Access</a></li>
|
||||
<li><a href="#fs2">Considerations on Flash Memory Media</a></li>
|
||||
<li><a href="#critical">Critical Section</a></li>
|
||||
<li><a href="#fs3">Extended Use of APIs</a></li>
|
||||
<li><a href="#license">About FatFs License</a></li>
|
||||
</ol>
|
||||
<hr>
|
||||
|
||||
<div class="para" id="port">
|
||||
<h3>How to Port</h3>
|
||||
|
||||
<h4>Basic considerations</h4>
|
||||
<p>The FatFs module is assuming following conditions on portability.</p>
|
||||
<ul>
|
||||
<li>ANSI C<br>
|
||||
The FatFs module is a middleware written in ANSI C (C89). There is no platform dependence, so long as the compiler is in compliance with ANSI C.</li>
|
||||
<li>Size of integer types<br>
|
||||
The FatFs module assumes that size of char/short/long are 8/16/32 bit and int is 16 or 32 bit. These correspondence are defined in <tt>integer.h</tt>. This will not be a problem on most compilers. When any conflict with existing definitions is occured, you must resolve it with care.</li>
|
||||
</ul>
|
||||
|
||||
<h4>System organizations</h4>
|
||||
<p>The dependency diagram shown below is a typical configuration of the embedded system with FatFs module.</p>
|
||||
<p><img src="../img/modules.png" width="580" height="280" alt="dependency diagram"></p>
|
||||
|
||||
<h4>Which function is required?</h4>
|
||||
<p>You need to provide only low level disk I/O functions that required by FatFs module and nothing else. If a working disk module for the target is already existing, you need to write only glue functions to attach it to the FatFs module. If not, you need to port any other disk module or write it from scratch. Most of defined functions are not that always required. For example, disk write function is not required in read-only configuration. Following table shows which function is required depends on configuration options.</p>
|
||||
<table class="lst2">
|
||||
<tr><th>Function</th><th>Required when:</th><th>Note</th></tr>
|
||||
<tr><td>disk_initialize<br>disk_status<br>disk_read</td><td>Always</td><td rowspan="5">Disk I/O functions.<br>Samples available in ffsample.zip.<br>There are many implementations on the web.</td></tr>
|
||||
<tr><td>disk_write<br>get_fattime<br>disk_ioctl (CTRL_SYNC)</td><td>_FS_READONLY == 0</td></tr>
|
||||
<tr><td>disk_ioctl (GET_SECTOR_COUNT)<br>disk_ioctl (GET_BLOCK_SIZE)</td><td>_USE_MKFS == 1</td></tr>
|
||||
<tr><td>disk_ioctl (GET_SECTOR_SIZE)</td><td>_MAX_SS > 512</td></tr>
|
||||
<tr><td>disk_ioctl (CTRL_ERASE_SECTOR)</td><td>_USE_ERASE == 1</td></tr>
|
||||
<tr><td>ff_convert<br>ff_wtoupper</td><td>_USE_LFN >= 1</td><td>Unicode support functions.<br>Available in option/cc*.c.</td></tr>
|
||||
<tr><td>ff_cre_syncobj<br>ff_del_syncobj<br>ff_req_grant<br>ff_rel_grant</td><td>_FS_REENTRANT == 1</td><td rowspan="2">O/S dependent functions.<br>Samples available in option/syscall.c.</td></tr>
|
||||
<tr><td>ff_mem_alloc<br>ff_mem_free</td><td>_USE_LFN == 3</td></tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="para" id="limits">
|
||||
<h3>Limits</h3>
|
||||
<ul>
|
||||
<li>FAT sub-types: FAT12, FAT16 and FAT32.</li>
|
||||
<li>Number of open files: Unlimited, depends on available memory.</li>
|
||||
<li>Number of volumes: Upto 10.</li>
|
||||
<li>File size: Depends on FAT specs. (upto 4G-1 bytes)</li>
|
||||
<li>Volume size: Depends on FAT specs. (upto 2T bytes at 512 bytes/sector)</li>
|
||||
<li>Cluster size: Depends on FAT specs. (upto 64K bytes at 512 bytes/sector)</li>
|
||||
<li>Sector size: Depends on FAT specs. (upto 4K bytes)</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="para" id="memory">
|
||||
<h3>Memory Usage</h3>
|
||||
<table class="lst2">
|
||||
<tr><th></th><th>ARM7<small><br>32bit</small></th><th>ARM7<small><br>Thumb</small></th><th>CM3<small><br>Thumb-2</small></th><th>AVR</th><th>H8/300H</th><th>PIC24</th><th>RL78</th><th>V850ES</th><th>SH-2A</th><th>RX600</th><th>IA-32</th></tr>
|
||||
<tr><td>Compiler</td><td>GCC</td><td>GCC</td><td>GCC</td><td>GCC</td><td>CH38</td><td>C30</td><td>CC78K0R</td><td>CA850</td><td>SHC</td><td>RXC</td><td>VC6</td></tr>
|
||||
<tr><td>_WORD_ACCESS</td><td>0</td><td>0</td><td>0</td><td>1</td><td>0</td><td>0</td><td>0</td><td>1</td><td>0</td><td>1</td><td>1</td></tr>
|
||||
<!-- *ARM *Thumb *CM3 *AVR *H8 *PIC24 *RL78 *V850ES *SH-2A *RX600 *IA-32 -->
|
||||
<tr class="lst3"><td>text (Full, R/W)</td><td>10591</td><td>7119</td><td>6565</td><td>13240</td><td>10864</td><td>11619</td><td>13192</td><td>8031</td><td>8960</td><td>5977</td><td>7856</td></tr>
|
||||
<tr> <td>text (Min, R/W)</td> <td>6671</td><td>4595</td><td>4293</td> <td>8512</td> <td>7232</td> <td>7674</td> <td>9033</td><td>5235</td><td>5768</td><td>3923</td><td>5129</td></tr>
|
||||
<tr> <td>text (Full, R/O)</td> <td>4695</td><td>3121</td><td>2861</td> <td>6218</td> <td>5162</td> <td>5466</td> <td>6418</td><td>3799</td><td>3964</td><td>2847</td><td>3687</td></tr>
|
||||
<tr> <td>text (Min, R/O)</td> <td>3523</td><td>2463</td><td>2275</td> <td>4558</td> <td>4058</td> <td>4212</td> <td>4948</td><td>2959</td><td>3096</td><td>2199</td><td>2857</td></tr>
|
||||
<tr> <td>bss</td><td>V*4 + 2</td><td>V*4 + 2</td><td>V*4 + 2</td><td>V*2 + 2</td><td>V*4 + 2</td><td>V*2 + 2</td><td>V*2 + 2</td><td>V*4 + 2</td><td>V*4 + 2</td><td>V*4 + 2</td><td>V*4 + 2</td></tr>
|
||||
<tr> <td>Work area<br>(_FS_TINY == 0)</td><td>V*560 +<br>F*550</td><td>V*560 +<br>F*550</td><td>V*560 +<br>F*550</td><td>V*560 +<br>F*544</td><td>V*560 +<br>F*550</td><td>V*560 +<br>F*544</td><td>V*560 +<br>F*544</td><td>V*560 +<br>F*544</td><td>V*560 +<br>F*550</td><td>V*560 +<br>F*550</td><td>V*560 +<br>F*550</td></tr>
|
||||
<tr><td>Work area<br>(_FS_TINY == 1)</td><td>V*560 +<br>F*36</td><td>V*560 +<br>F*36</td><td>V*560 +<br>F*36</td><td>V*560 +<br>F*32</td><td>V*560 +<br>F*36</td><td>V*560 +<br>F*32</td><td>V*560 +<br>F*32</td><td>V*560 +<br>F*36</td><td>V*560 +<br>F*36</td><td>V*560 +<br>F*36</td><td>V*560 +<br>F*36</td></tr>
|
||||
</table>
|
||||
<p>These are the memory usage on some target systems with following condition. The memory sizes are in unit of byte, <em>V</em> denotes number of volumes and <em>F</em> denotes number of open files. All samples are optimezed in code size.</p>
|
||||
<pre>
|
||||
FatFs R0.10 options:
|
||||
_FS_READONLY 0 (R/W), 1 (R/O)
|
||||
_FS_MINIMIZE 0 (Full function), 3 (Minimized function)
|
||||
_USE_STRFUNC 0 (Disable string functions)
|
||||
_USE_MKFS 0 (Disable f_mkfs function)
|
||||
_USE_FORWARD 0 (Disable f_forward function)
|
||||
_USE_FASTSEEK 0 (Disable fast seek feature)
|
||||
_CODE_PAGE 932 (Japanese Shift-JIS)
|
||||
_USE_LFN 0 (Disable LFN)
|
||||
_MAX_SS 512 (Fixed sector size)
|
||||
_FS_RPATH 0 (Disable relative path feature)
|
||||
_FS_LABEL 0 (Disable volume label functions)
|
||||
_VOLUMES V (Number of logical drives to be used)
|
||||
_MULTI_PARTITION 0 (Single partition per drive)
|
||||
_FS_REENTRANT 0 (Disable reentrancy)
|
||||
_FS_LOCK 0 (Disable file lock control)
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<div class="para" id="reduce">
|
||||
<h3>Module Size Reduction</h3>
|
||||
<p>Follwing table shows which API function is removed by configuration options for the module size reduction.</p>
|
||||
<table class="lst2">
|
||||
<tr><td rowspan="2">Function</td><td colspan="4">_FS_MINIMIZE</td><td colspan="2">_FS_READONLY</td><td colspan="2">_USE_STRFUNC</td><td colspan="3">_FS_RPATH</td><td colspan="2">_FS_LABEL</td><td colspan="2">_USE_MKFS</td><td colspan="2">_USE_FORWARD</td><td colspan="2">_MULTI_PARTITION</td></tr>
|
||||
<tr><td>0</td><td>1</td><td>2</td><td>3</td><td>0</td><td>1</td><td>0 </td><td>1/2</td><td>0</td><td>1</td><td>2</td><td>0</td><td>1</td><td>0</td><td>1</td><td>0</td><td>1</td><td>0</td><td>1</td></tr>
|
||||
<tr class="lst3"><td>f_mount</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
|
||||
<tr><td>f_open</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
|
||||
<tr><td>f_close</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
|
||||
<tr><td>f_read</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
|
||||
<tr><td>f_write</td><td></td><td></td><td></td><td></td><td></td><td>x</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
|
||||
<tr><td>f_sync</td><td></td><td></td><td></td><td></td><td></td><td>x</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
|
||||
<tr><td>f_lseek</td><td></td><td></td><td></td><td>x</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
|
||||
<tr><td>f_opendir</td><td></td><td></td><td>x</td><td>x</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
|
||||
<tr><td>f_closedir</td><td></td><td></td><td>x</td><td>x</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
|
||||
<tr><td>f_readdir</td><td></td><td></td><td>x</td><td>x</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
|
||||
<tr><td>f_stat</td><td></td><td>x</td><td>x</td><td>x</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
|
||||
<tr><td>f_getfree</td><td></td><td>x</td><td>x</td><td>x</td><td></td><td>x</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
|
||||
<tr><td>f_truncate</td><td></td><td>x</td><td>x</td><td>x</td><td></td><td>x</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
|
||||
<tr><td>f_unlink</td><td></td><td>x</td><td>x</td><td>x</td><td></td><td>x</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
|
||||
<tr><td>f_mkdir</td><td></td><td>x</td><td>x</td><td>x</td><td></td><td>x</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
|
||||
<tr><td>f_chmod</td><td></td><td>x</td><td>x</td><td>x</td><td></td><td>x</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
|
||||
<tr><td>f_utime</td><td></td><td>x</td><td>x</td><td>x</td><td></td><td>x</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
|
||||
<tr><td>f_rename</td><td></td><td>x</td><td>x</td><td>x</td><td></td><td>x</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
|
||||
<tr><td>f_chdir</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>x</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
|
||||
<tr><td>f_chdrive</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>x</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
|
||||
<tr><td>f_getcwd</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>x</td><td>x</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
|
||||
<tr><td>f_getlabel</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>x</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
|
||||
<tr><td>f_setlabel</td><td></td><td></td><td></td><td></td><td></td><td>x</td><td></td><td></td><td></td><td></td><td></td><td>x</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
|
||||
<tr><td>f_forward</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>x</td><td></td><td></td><td></td></tr>
|
||||
<tr><td>f_mkfs</td><td></td><td></td><td></td><td></td><td></td><td>x</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>x</td><td></td><td></td><td></td><td></td><td></td></tr>
|
||||
<tr><td>f_fdisk</td><td></td><td></td><td></td><td></td><td></td><td>x</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>x</td><td></td><td></td><td></td><td>x</td><td></td></tr>
|
||||
<tr><td>f_putc</td><td></td><td></td><td></td><td></td><td></td><td>x</td><td>x</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
|
||||
<tr><td>f_puts</td><td></td><td></td><td></td><td></td><td></td><td>x</td><td>x</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
|
||||
<tr><td>f_printf</td><td></td><td></td><td></td><td></td><td></td><td>x</td><td>x</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
|
||||
<tr><td>f_gets</td><td></td><td></td><td></td><td></td><td></td><td></td><td>x</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="para" id="lfn">
|
||||
<h3>Long File Name</h3>
|
||||
<p>The FatFs module has started to support long file name (LFN) at revision 0.07. The two different file names, SFN and LFN, of a file is transparent in the file functions except for f_readdir function. To enable LFN feature, set <tt>_USE_LFN</tt> to 1, 2 or 3, and add a Unicode code conversion function <tt>ff_convert()</tt> and <tt>ff_wtoupper()</tt> to the project. The LFN feature requiers a certain working buffer in addition. The buffer size can be configured by <tt>_MAX_LFN</tt> corresponding to the available memory size. The size of long file name will reach up to 255 characters, so that the <tt>_MAX_LFN</tt> should be set to 255 for full featured LFN operation. If the size of working buffer is insufficient for the given file name, the file function fails with <tt>FR_INVALID_NAME</tt>. When enable the LFN feature with re-entrant feature, <tt>_USE_LFN</tt> must be set to 2 or 3. In this case, the file function allocates the working buffer on the stack or heap. The working buffer occupies <tt>(_MAX_LFN + 1) * 2</tt> bytes.</p>
|
||||
<table class="lst2 rset">
|
||||
<caption>LFN cfg on ARM7TDMI</caption>
|
||||
<tr><th>Code page</th><th>Program size</th></tr>
|
||||
<tr><td>SBCS</td><td>+3.7K</td></tr>
|
||||
<tr><td>932(Shift-JIS)</td><td>+62K</td></tr>
|
||||
<tr><td>936(GBK)</td><td>+177K</td></tr>
|
||||
<tr><td>949(Korean)</td><td>+139K</td></tr>
|
||||
<tr><td>950(Big5)</td><td>+111K</td></tr>
|
||||
</table>
|
||||
<p>When the LFN feature is enabled, the module size will be increased depends on the selected code page. Right table shows how many bytes increased when LFN feature is enabled with some code pages. Especially, in the CJK region, tens of thousands of characters are being used. Unfortunately, it requires a huge OEM-Unicode bidirectional conversion table and the module size will be drastically increased that shown in the table. As the result, the FatFs with LFN feature with those code pages will not able to be implemented to most 8-bit microcontrollers.</p>
|
||||
<p>Note that the LFN feature on the FAT file system is a patent of Microsoft Corporation. This is not the case on FAT32 but most FAT32 drivers come with the LFN feature. FatFs can swich the LFN feature off by configuration option. When enable LFN feature on the commercial products, a license from Microsoft may be required depends on the final destination.</p>
|
||||
</div>
|
||||
|
||||
<div class="para" id="unicode">
|
||||
<h3>Unicode API</h3>
|
||||
<p>By default, FatFs uses ANSI/OEM code set on the API under LFN configuration. FatFs can also switch the character encoding to Unicode on the API (<tt>_LFN_UNICODE</tt>). This means the FatFs supports the True-LFN feature. For more information, refer to the description in the <a href="filename.html">file name</a>.</p>
|
||||
</div>
|
||||
|
||||
<div class="para" id="reentrant">
|
||||
<h3>Re-entrancy</h3>
|
||||
<p>The file operations to the different volume is always re-entrant and can work simultaneously. The file operations to the same volume is not re-entrant but it can also be configured to thread-safe with <tt>_FS_REENTRANT</tt> option. In this case, also the OS dependent synchronization object control functions, <tt>ff_cre_syncobj(), ff_del_syncobj(), ff_req_grant() and ff_rel_grant()</tt> must be added to the project.</p>
|
||||
<p>When a file function is called while the volume is in use by any other task, the file function is suspended until that task leaves file function. If wait time exceeded a period defined by <tt>_TIMEOUT</tt>, the file function will abort with <tt>FR_TIMEOUT</tt>. The timeout feature might not be supported by some RTOS.</p>
|
||||
<p>There is an exception for <tt>f_mount(), f_mkfs(), f_fdisk()</tt> function. These functions are not re-entrant to the same volume or corresponding physical drive. When use these functions, all other tasks must unmount the volume and avoid to access the volume.</p>
|
||||
<p>Note that this section describes on the re-entrancy of the FatFs module itself but also the low level disk I/O layer will need to be re-entrant.</p>
|
||||
</div>
|
||||
|
||||
<div class="para" id="dup">
|
||||
<h3>Duplicated File Access</h3>
|
||||
<p>FatFs module does not support the shareing controls of duplicated file access in default. It is permitted when open method to a file is only read mode. The duplicated open in write mode to a file is always prohibited and open file must not be renamed, deleted, or the FAT structure on the volume can be collapted.</p>
|
||||
<p>The file shareing control can also be available when <tt>_FS_LOCK</tt> is set to 1 or grater. The value specifies the number of files to manage simultaneously. In this case, if any open, rename or remove that violating the file shareing rule that described above is attempted, the file function will fail with <tt>FR_LOCKED</tt>. If number of open objects gets larger than <tt>_FS_LOCK</tt>, the <tt>f_open()/f_opendir()</tt> function will fail with <tt>FR_TOO_MANY_OPEN_FILES</tt>.</p>
|
||||
</div>
|
||||
|
||||
<div class="para" id="fs1">
|
||||
<h3>Performance Effective File Access</h3>
|
||||
<p>For good performance to read/write files on the small embedded system, application programmer should consider what process is done in the FatFs module. The file data on the volume is transferred in following sequence by <tt>f_read()</tt> function.</p>
|
||||
<p>Figure 1. Sector miss-aligned read (short)<br>
|
||||
<img src="../img/f1.png" width="490" height="110" alt="">
|
||||
</p>
|
||||
<p>Figure 2. Sector miss-aligned read (long)<br>
|
||||
<img src="../img/f2.png" width="490" height="140" alt="">
|
||||
</p>
|
||||
<p>Figure 3. Sector aligned read<br>
|
||||
<img src="../img/f3.png" width="490" height="119" alt="">
|
||||
</p>
|
||||
<p>The file I/O buffer is a sector buffer to read/write a partial data on the sector. The sector buffer is either file private sector buffer on each file object or shared sector buffer in the file system object. The buffer configuration option <tt>_FS_TINY</tt> determins which sector buffer is used for the file data transfer. When tiny buffer (1) is selected, data memory consumption is reduced 512 bytes each file object. In this case, FatFs module uses only a sector buffer in the file system object for file data transfer and FAT/directory access. The disadvantage of the tiny buffer configuration is: the FAT data cached in the sector buffer will be lost by file data transfer and it must be reloaded at every cluster boundary. However it will be suitable for most application from view point of the decent performance and low memory comsumption.</p>
|
||||
<p>Figure 1 shows that a partial sector, sector mis-aligned part of the file, is transferred via the file I/O buffer. On long data transfer shown in Figure 2, middle of transfer data that covers one or more sector is transferred to the application buffer directly. Figure 3 shows that the case of entier transfer data is aligned to the sector boundary. In this case, file I/O buffer is not used. On the direct transfer, the maximum extent of sectors are read with <tt>disk_read()</tt> function at a time but the multiple sector transfer never across the cluster boundary even if it is contiguous.</p>
|
||||
<p>Therefore taking effort to sector aligned read/write accesss avoids buffered data transfer and the read/write performance will be improved. Besides the effect, cached FAT data will not be flushed by file data transfer at the tiny configuration, so that it can achieve same performance as non-tiny configuration with small memory footprint.</p>
|
||||
</div>
|
||||
|
||||
<div class="para" id="fs2">
|
||||
<h3>Considerations on Flash Memory Media</h3>
|
||||
<p>To maximize the write performance of flash memory media, such as SDC and CFC, it must be controlled in consideration of its characteristitcs.</p>
|
||||
<h4>Using Mutiple-Sector Write</h4>
|
||||
<div class="rset">
|
||||
Figure 6. Comparison between Multiple/Single Sector Write<br>
|
||||
<img src="../img/f6.png" width="630" height="148" alt="fig.6">
|
||||
</div>
|
||||
<p>The write throughput of the flash memory media becomes the worst at single sector write and it increases proportional to the number of sectors per a write transaction. This effect more appers at more fast bus clock and its ratio often becomes grater than ten. The number of write transaction also affects the life time of the media. Therefore the application program should write the data in large block as possible. The ideal block size is cluster size or power of 2 bytes and the byte offset should be aligned to the block. Of course all layers between the application and the media must support multiple sector write feature, however most of open-source disk drivers lack it. Do not split a multiple sector write request into single sector writes or the write throughput gets poor. Note that FatFs module and its sample disk drivers supprt multiple sector read/write feature.</p>
|
||||
<h4>Forcing Memory Erase</h4>
|
||||
<p>When remove a file with <tt>f_remove()</tt> function, the data clusters occupied by the file are marked 'free' on the FAT. But the data sectors containing the file data are not that applied any process, so that the file data left occupies a part of the flash memory array as 'live block'. If the file data is forced erased on removing the file, the number of free blocks on the flash memory will be increased. This may skip internal block erase operation to the data block on next write. As the result the write performance might be improved. To enable this feature, set <tt>_USE_ERASE</tt> to 1. Note that this is a feature with expectation of internal process of the flash memory media. It may not always effective and <tt>f_remove()</tt> function will take a time to remove a large file. Most applications will not need this feature.</p>
|
||||
</div>
|
||||
|
||||
<div class="para" id="critical">
|
||||
<h3>Critical Section</h3>
|
||||
<p>If a write operation to the FAT volume is interrupted due to any accidental failure, such as sudden blackout, incorrect disk removal and unrecoverable disk error, the FAT structure on the volume can be collapted. Following images shows the critical section of the FatFs module.</p>
|
||||
<div class="lset">
|
||||
Figure 4. Long critical section<br>
|
||||
<img src="../img/f4.png" width="320" height="436" alt="fig.4">
|
||||
</div>
|
||||
<div class="lset">
|
||||
Figure 5. Minimized critical section<br>
|
||||
<img src="../img/f5.png" width="320" height="436" alt="fig.5">
|
||||
</div>
|
||||
<br class="clr">
|
||||
<p>An interruption in the red section can cause a cross link; as a result, the object being changed can be lost. If an interruption in the yellow section is occured, there is one or more possibility listed below.</p>
|
||||
<ul>
|
||||
<li>The file data being rewrited is collapted.</li>
|
||||
<li>The file being appended returns initial state.</li>
|
||||
<li>The file created as new is gone.</li>
|
||||
<li>The file created as new or overwritten remains but no content.</li>
|
||||
<li>Efficiency of disk use gets worse due to lost clusters.</li>
|
||||
</ul>
|
||||
<p>Each case does not affect the files that not opened in write mode. To minimize risk of data loss, the critical section can be minimized by minimizing the time that file is opened in write mode or using <tt>f_sync()</tt> function as shown in Figure 5.</p>
|
||||
</div>
|
||||
|
||||
<div class="para" id="fs3">
|
||||
<h3>Extended Use of APIs</h3>
|
||||
<p>These are examples of extended use of FatFs APIs. New item will be added whenever a useful code is found.</p>
|
||||
<ol>
|
||||
<li><a href="../img/app1.c">Open or create a file for append</a></li>
|
||||
<li><a href="../img/app2.c">Empty a directory</a></li>
|
||||
<li><a href="../img/app3.c">Allocate contiguous area to the file</a></li>
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
<div class="para" id="license">
|
||||
<h3>About FatFs License</h3>
|
||||
<p>This is a copy of the FatFs license document that included in the source codes.</p>
|
||||
<pre>/*----------------------------------------------------------------------------/
|
||||
/ FatFs - FAT file system module R0.10 (C)ChaN, 2013
|
||||
/-----------------------------------------------------------------------------/
|
||||
/ FatFs module is a generic FAT file system module for small embedded systems.
|
||||
/ This is a free software that opened for education, research and commercial
|
||||
/ developments under license policy of following trems.
|
||||
/
|
||||
/ Copyright (C) 2013, ChaN, all right reserved.
|
||||
/
|
||||
/ * The FatFs module is a free software and there is NO WARRANTY.
|
||||
/ * No restriction on use. You can use, modify and redistribute it for
|
||||
/ personal, non-profit or commercial products UNDER YOUR RESPONSIBILITY.
|
||||
/ * Redistributions of source code must retain the above copyright notice.
|
||||
/
|
||||
/-----------------------------------------------------------------------------/</pre>
|
||||
<p>Therefore FatFs license is one of the BSD-style license but there is a significant feature. Because FatFs is for embedded projects, the conditions for redistributions in binary form, such as embedded code, hex file and binary library, are not specified to increase its usability. The documentation of the distributions need not include about FatFs and its license document, and it may also. This is equivalent to the BSD 1-Clause License. Of course FatFs is compatible with the projects under GNU GPL. When redistribute the FatFs with any modification, the license can also be changed to GNU GPL or BSD-style license.</p>
|
||||
</div>
|
||||
|
||||
<p class="foot"><a href="../00index_e.html">Return</a></p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,81 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
<link rel="up" title="FatFs" href="../00index_e.html">
|
||||
<link rel="alternate" hreflang="ja" title="Japanese" href="../ja/chdir.html">
|
||||
<link rel="stylesheet" href="../css_e.css" type="text/css" media="screen" title="ELM Default">
|
||||
<title>FatFs - f_chdir</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="para func">
|
||||
<h2>f_chdir</h2>
|
||||
<p>The f_chdir function changes the current directory of a drive.</p>
|
||||
<pre>
|
||||
FRESULT f_chdir (
|
||||
const TCHAR* <span class="arg">path</span> <span class="c">/* [IN] Path name */</span>
|
||||
);
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<div class="para arg">
|
||||
<h4>Parameters</h4>
|
||||
<dl class="par">
|
||||
<dt>path</dt>
|
||||
<dd>Pointer to the null-terminated string that specifies a <a href="filename.html">directory</a> to go.</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="para ret">
|
||||
<h4>Return Values</h4>
|
||||
<p>
|
||||
<a href="rc.html#ok">FR_OK</a>,
|
||||
<a href="rc.html#de">FR_DISK_ERR</a>,
|
||||
<a href="rc.html#ie">FR_INT_ERR</a>,
|
||||
<a href="rc.html#nr">FR_NOT_READY</a>,
|
||||
<a href="rc.html#np">FR_NO_PATH</a>,
|
||||
<a href="rc.html#in">FR_INVALID_NAME</a>,
|
||||
<a href="rc.html#id">FR_INVALID_DRIVE</a>,
|
||||
<a href="rc.html#ne">FR_NOT_ENABLED</a>,
|
||||
<a href="rc.html#ns">FR_NO_FILESYSTEM</a>,
|
||||
<a href="rc.html#tm">FR_TIMEOUT</a>,
|
||||
<a href="rc.html#nc">FR_NOT_ENOUGH_CORE</a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="para desc">
|
||||
<h4>Description</h4>
|
||||
<p>The <tt>f_chdir()</tt> function changes the current directory of the logical drive. The current directory of a drive is initialized to the root directory when the drive is auto-mounted. Note that the current directory is retained in the each file system object so that it also affects other tasks that using the volume.</p>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="para comp">
|
||||
<h4>QuickInfo</h4>
|
||||
<p>Available when <tt>_FS_RPATH >= 1</tt>.</p>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="para use">
|
||||
<h4>Example</h4>
|
||||
<pre>
|
||||
<span class="c">/* Change current direcoty of the current drive (dir1 under root dir) */</span>
|
||||
f_chdir("/dir1");
|
||||
|
||||
<span class="c">/* Change current direcoty of drive 2 (parent dir) */</span>
|
||||
f_chdir("2:..");
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<div class="para ref">
|
||||
<h4>See Also</h4>
|
||||
<p><tt><a href="chdrive.html">f_chdrive</a>, <a href="getcwd.html">f_getcwd</a></tt></p>
|
||||
</div>
|
||||
|
||||
<p class="foot"><a href="../00index_e.html">Return</a></p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,60 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
<link rel="up" title="FatFs" href="../00index_e.html">
|
||||
<link rel="alternate" hreflang="ja" title="Japanese" href="../ja/chdrive.html">
|
||||
<link rel="stylesheet" href="../css_e.css" type="text/css" media="screen" title="ELM Default">
|
||||
<title>FatFs - f_chdrive</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="para func">
|
||||
<h2>f_chdrive</h2>
|
||||
<p>The f_chdrive function changes the current drive.</p>
|
||||
<pre>
|
||||
FRESULT f_chdrive (
|
||||
const TCHAR* <span class="arg">path</span> <span class="c">/* [IN] Logical drive number */</span>
|
||||
);
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<div class="para arg">
|
||||
<h4>Parameters</h4>
|
||||
<dl class="par">
|
||||
<dt>path</dt>
|
||||
<dd>Specifies the <a href="filename.html">logical drive number</a> to be set as the current drive.</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="para ret">
|
||||
<h4>Return Values</h4>
|
||||
<p>
|
||||
<a href="rc.html#ok">FR_OK</a>,
|
||||
<a href="rc.html#id">FR_INVALID_DRIVE</a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="para desc">
|
||||
<h4>Description</h4>
|
||||
<p>The <tt>f_chdrive()</tt> function changes the current drive. The initial value of the current drive number is 0. Note that the current drive is retained in a static variable so that it also affects other tasks that using the file functions.</p>
|
||||
</div>
|
||||
|
||||
<div class="para comp">
|
||||
<h4>QuickInfo</h4>
|
||||
<p>Available when <tt>_FS_RPATH >= 1</tt> and <tt>_VOLUMES >= 2</tt>.</p>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="para ref">
|
||||
<h4>See Also</h4>
|
||||
<p><tt><a href="chdir.html">f_chdir</a>, <a href="getcwd.html">f_getcwd</a></tt></p>
|
||||
</div>
|
||||
|
||||
<p class="foot"><a href="../00index_e.html">Return</a></p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,89 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
<link rel="up" title="FatFs" href="../00index_e.html">
|
||||
<link rel="alternate" hreflang="ja" title="Japanese" href="../ja/chmod.html">
|
||||
<link rel="stylesheet" href="../css_e.css" type="text/css" media="screen" title="ELM Default">
|
||||
<title>FatFs - f_chmod</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="para func">
|
||||
<h2>f_chmod</h2>
|
||||
<p>The f_chmod function changes the attribute of a file or sub-directory.</p>
|
||||
<pre>
|
||||
FRESULT f_chmod (
|
||||
const TCHAR* <span class="arg">path</span>, <span class="c">/* [IN] Object name */</span>
|
||||
BYTE <span class="arg">attr</span>, <span class="c">/* [IN] Attribute flags */</span>
|
||||
BYTE <span class="arg">mask</span> <span class="c">/* [IN] Attribute masks */</span>
|
||||
);
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<div class="para arg">
|
||||
<h4>Parameters</h4>
|
||||
<dl class="par">
|
||||
<dt>path</dt>
|
||||
<dd>Pointer to the null-terminated string that specifies an <a href="filename.html">object</a> to be changed</dd>
|
||||
<dt>attr</dt>
|
||||
<dd>Attribute flags to be set in one or more combination of the following flags. The specified flags are set and others are cleard.<br>
|
||||
<table class="lst">
|
||||
<tr><th>Attribute</th><th>Description</th></tr>
|
||||
<tr><td>AM_RDO</td><td>Read only</td></tr>
|
||||
<tr><td>AM_ARC</td><td>Archive</td></tr>
|
||||
<tr><td>AM_SYS</td><td>System</td></tr>
|
||||
<tr><td>AM_HID</td><td>Hidden</td></tr>
|
||||
</table>
|
||||
</dd>
|
||||
<dt>mask</dt>
|
||||
<dd>Attribute mask that specifies which attribute is changed. The specified aattributes are set or cleard.</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="para ret">
|
||||
<h4>Return Values</h4>
|
||||
<p>
|
||||
<a href="rc.html#ok">FR_OK</a>,
|
||||
<a href="rc.html#de">FR_DISK_ERR</a>,
|
||||
<a href="rc.html#ie">FR_INT_ERR</a>,
|
||||
<a href="rc.html#nr">FR_NOT_READY</a>,
|
||||
<a href="rc.html#ok">FR_NO_FILE</a>,
|
||||
<a href="rc.html#np">FR_NO_PATH</a>,
|
||||
<a href="rc.html#in">FR_INVALID_NAME</a>,
|
||||
<a href="rc.html#wp">FR_WRITE_PROTECTED</a>,
|
||||
<a href="rc.html#id">FR_INVALID_DRIVE</a>,
|
||||
<a href="rc.html#ne">FR_NOT_ENABLED</a>,
|
||||
<a href="rc.html#ns">FR_NO_FILESYSTEM</a>,
|
||||
<a href="rc.html#tm">FR_TIMEOUT</a>,
|
||||
<a href="rc.html#nc">FR_NOT_ENOUGH_CORE</a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="para desc">
|
||||
<h4>Description</h4>
|
||||
<p>The <tt>f_chmod()</tt> function changes the attribute of a file or sub-directory.</p>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="para comp">
|
||||
<h4>QuickInfo</h4>
|
||||
<p>Available when <tt>_FS_READONLY == 0</tt> and <tt>_FS_MINIMIZE == 0</tt>.</p>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="para use">
|
||||
<h4>Example</h4>
|
||||
<pre>
|
||||
<span class="c">/* Set read-only flag, clear archive flag and others are retained. */</span>
|
||||
f_chmod("file.txt", AR_RDO, AR_RDO | AR_ARC);
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p class="foot"><a href="../00index_e.html">Return</a></p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,66 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
<link rel="up" title="FatFs" href="../00index_e.html">
|
||||
<link rel="alternate" hreflang="ja" title="Japanese" href="../ja/close.html">
|
||||
<link rel="stylesheet" href="../css_e.css" type="text/css" media="screen" title="ELM Default">
|
||||
<title>FatFs - f_close</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="para func">
|
||||
<h2>f_close</h2>
|
||||
<p>The f_close function closes an open file.</p>
|
||||
<pre>
|
||||
FRESULT f_close (
|
||||
FIL* <span class="arg">fp</span> <span class="c">/* [IN] Pointer to the file object */</span>
|
||||
);
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<div class="para arg">
|
||||
<h4>Parameter</h4>
|
||||
<dl class="par">
|
||||
<dt>fp</dt>
|
||||
<dd>Pointer to the open file object structure to be closed.</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="para ret">
|
||||
<h4>Return Values</h4>
|
||||
<p>
|
||||
<a href="rc.html#ok">FR_OK</a>,
|
||||
<a href="rc.html#de">FR_DISK_ERR</a>,
|
||||
<a href="rc.html#ie">FR_INT_ERR</a>,
|
||||
<a href="rc.html#nr">FR_NOT_READY</a>,
|
||||
<a href="rc.html#io">FR_INVALID_OBJECT</a>,
|
||||
<a href="rc.html#tm">FR_TIMEOUT</a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="para desc">
|
||||
<h4>Description</h4>
|
||||
<p>The <tt>f_close()</tt> function closes an open file object. If any data has been written to the file, the cached information of the file is written back to the volume. After the function succeeded, the file object is no longer valid and it can be discarded.</p>
|
||||
<p>Note that if the file object is in read-only mode and <tt>_FS_LOCK</tt> option is not enabled, the file object can also be discarded without this process. However it is not recommended for future compatibility.</p>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="para comp">
|
||||
<h4>QuickInfo</h4>
|
||||
<p>Always available.</p>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="para ref">
|
||||
<h4>See Also</h4>
|
||||
<p><tt><a href="open.html">f_open</a>, <a href="read.html">f_read</a>, <a href="write.html">f_write</a>, <a href="sync.html">f_sync</a>, <a href="sfile.html">FIL</a>, <a href="sfatfs.html">FATFS</a></tt></p>
|
||||
</div>
|
||||
|
||||
<p class="foot"><a href="../00index_e.html">Return</a></p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,64 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
<link rel="up" title="FatFs" href="../00index_e.html">
|
||||
<link rel="alternate" hreflang="ja" title="Japanese" href="../ja/close.html">
|
||||
<link rel="stylesheet" href="../css_e.css" type="text/css" media="screen" title="ELM Default">
|
||||
<title>FatFs - f_closedir</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="para func">
|
||||
<h2>f_closedir</h2>
|
||||
<p>The f_closedir function closes an open directory.</p>
|
||||
<pre>
|
||||
FRESULT f_closedir (
|
||||
DIR* <span class="arg">dp</span> <span class="c">/* [IN] Pointer to the directory object */</span>
|
||||
);
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<div class="para arg">
|
||||
<h4>Parameter</h4>
|
||||
<dl class="par">
|
||||
<dt>dp</dt>
|
||||
<dd>Pointer to the open directory object structure to be closed.</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="para ret">
|
||||
<h4>Return Values</h4>
|
||||
<p>
|
||||
<a href="rc.html#ok">FR_OK</a>,
|
||||
<a href="rc.html#ie">FR_INT_ERR</a>,
|
||||
<a href="rc.html#io">FR_INVALID_OBJECT</a>,
|
||||
<a href="rc.html#tm">FR_TIMEOUT</a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="para desc">
|
||||
<h4>Description</h4>
|
||||
<p>The <tt>f_closedir()</tt> function closes an open directory object. After the function succeeded, the file object is no longer valid and it can be discarded.</p>
|
||||
<p>Note that the directory object can also be discarded without this process unless <tt>_FS_LOCK</tt> option is not enabled. However it is not recommended for future compatibility.</p>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="para comp">
|
||||
<h4>QuickInfo</h4>
|
||||
<p>Available when <tt>_FS_MINIMIZE <= 1</tt>.</p>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="para ref">
|
||||
<h4>See Also</h4>
|
||||
<p><tt><a href="opendir.html">f_opendir</a>, <a href="readdir.html">f_readdir</a>, <a href="sdir.html">DIR</a></tt></p>
|
||||
</div>
|
||||
|
||||
<p class="foot"><a href="../00index_e.html">Return</a></p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,46 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
<link rel="up" title="FatFs" href="../00index_e.html">
|
||||
<link rel="alternate" hreflang="ja" title="Japanese" href="../ja/dinit.html">
|
||||
<link rel="stylesheet" href="../css_e.css" type="text/css" media="screen" title="ELM Default">
|
||||
<title>FatFs - disk_initialize</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="para func">
|
||||
<h2>disk_initialize</h2>
|
||||
<p>The disk_initialize function initializes the disk drive.</p>
|
||||
<pre>
|
||||
DSTATUS disk_initialize (
|
||||
BYTE <span class="arg">pdrv</span> <span class="c">/* [IN] Physical drive number */</span>
|
||||
);
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<div class="para arg">
|
||||
<h4>Parameter</h4>
|
||||
<dl class="par">
|
||||
<dt>pdrv</dt>
|
||||
<dd>Specifies the physical drive number to initialize.</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="para ret">
|
||||
<h4>Return Values</h4>
|
||||
<p>This function returns a disk status as the result. For details of the disk status, refer to the <a href="dstat.html">disk_status()</a> function.</p>
|
||||
</div>
|
||||
|
||||
<div class="para desc">
|
||||
<h4>Description</h4>
|
||||
<p>This function initializes a physical drive and put it ready to generic read/write data. When the function succeeded, <tt>STA_NOINIT</tt> flag in the return value is cleared.</p>
|
||||
<p><em>Application program MUST NOT call this function while FatFs is in use, or FAT structure on the volume can be corrapted. To re-initialize the file system, use <tt>f_mount()</tt> function instead.</em> This function is called on volume mount process by FatFs module to manage the media change.</p>
|
||||
</div>
|
||||
|
||||
<p class="foot"><a href="../00index_e.html">Return</a></p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,69 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
<link rel="up" title="FatFs" href="../00index_e.html">
|
||||
<link rel="alternate" hreflang="ja" title="Japanese" href="../ja/dioctl.html">
|
||||
<link rel="stylesheet" href="../css_e.css" type="text/css" media="screen" title="ELM Default">
|
||||
<title>FatFs - disk_ioctl</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="para func">
|
||||
<h2>disk_ioctl</h2>
|
||||
<p>The disk_ioctl function cntrols device specific features and miscellaneous functions other than generic read/write.</p>
|
||||
<pre>
|
||||
DRESULT disk_ioctl (
|
||||
BYTE <span class="arg">pdrv</span>, <span class="c">/* [IN] Drive number */</span>
|
||||
BYTE <span class="arg">cmd</span>, <span class="c">/* [IN] Control command code */</span>
|
||||
void* <span class="arg">buff</span> <span class="c">/* [I/O] Parameter and data buffer */</span>
|
||||
);
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<div class="para arg">
|
||||
<h4>Parameters</h4>
|
||||
<dl class="par">
|
||||
<dt>pdrv</dt>
|
||||
<dd>Specifies the drive number (0-9).</dd>
|
||||
<dt>cmd</dt>
|
||||
<dd>Specifies the command code.</dd>
|
||||
<dt>buff</dt>
|
||||
<dd>Pointer to the parameter buffer depends on the command code. Set NULL if not used.</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="para ret">
|
||||
<h4>Return Value</h4>
|
||||
<dl class="ret">
|
||||
<dt>RES_OK (0)</dt>
|
||||
<dd>The function succeeded.</dd>
|
||||
<dt>RES_ERROR</dt>
|
||||
<dd>Any error occured.</dd>
|
||||
<dt>RES_PARERR</dt>
|
||||
<dd>Invalid command code or parameter.</dd>
|
||||
<dt>RES_NOTRDY</dt>
|
||||
<dd>The disk drive has not been initialized.</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="para desc">
|
||||
<h4>Description</h4>
|
||||
<p>The FatFs module uses only device independent commands described below. Any device dependent function is not used.</p>
|
||||
<table class="lst">
|
||||
<tr><th>Command</th><th>Description</th></tr>
|
||||
<tr><td>CTRL_SYNC</td><td>Make sure that the disk drive has finished pending write process. When the disk I/O module has a write back cache, flush the dirty sector immediately. This command is not used in read-only configuration.</td></tr>
|
||||
<tr><td>GET_SECTOR_SIZE</td><td>Returns sector size of the drive into the <tt>WORD</tt> variable pointed by <tt class="arg">buff</tt>. This command is not used in fixed sector size configuration, <tt>_MAX_SS</tt> is 512.</td></tr>
|
||||
<tr><td>GET_SECTOR_COUNT</td><td>Returns number of available sectors on the drive into the <tt>DWORD</tt> variable pointed by <tt class="arg">buff</tt>. This command is used by only <tt>f_mkfs()</tt> function to determine the volume size to be created.</td></tr>
|
||||
<tr><td>GET_BLOCK_SIZE</td><td>Returns erase block size of the flash memory in unit of sector into the <tt>DWORD</tt> variable pointed by <tt class="arg">buff</tt>. The allowable value is 1 to 32768 in power of 2. Return 1 if the erase block size is unknown or disk devices. This command is used by only <tt>f_mkfs()</tt> function and it attempts to align data area to the erase block boundary.</td></tr>
|
||||
<tr><td>CTRL_ERASE_SECTOR</td><td>Erases a part of the flash memory specified by a <tt>DWORD</tt> array {<start sector>, <end sector>} pointed by <tt class="arg">buff</tt>. This is similar command to Trim command of ATA command set. When this feature is not supported or not a flash memory media, this command has no effect. The FatFs does not check the result code and the file function is not affected even if the sectors are not erased well. This command is called on removing a cluster chain when <tt>_USE_ERASE</tt> is 1.</td></tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<p class="foot"><a href="../00index_e.html">Return</a></p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,70 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
<link rel="up" title="FatFs" href="../00index_e.html">
|
||||
<link rel="alternate" hreflang="ja" title="Japanese" href="../ja/dread.html">
|
||||
<link rel="stylesheet" href="../css_e.css" type="text/css" media="screen" title="ELM Default">
|
||||
<title>FatFs - disk_read</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="para func">
|
||||
<h2>disk_read</h2>
|
||||
<p>The disk_read function reads sector(s) from the disk drive.</p>
|
||||
<pre>
|
||||
DRESULT disk_read (
|
||||
BYTE <span class="arg">pdrv</span>, <span class="c">/* [IN] Physical drive number */</span>
|
||||
BYTE* <span class="arg">buff</span>, <span class="c">/* [OUT] Pointer to the read data buffer */</span>
|
||||
DWORD <span class="arg">sector</span>, <span class="c">/* [IN] Start sector number */</span>
|
||||
UINT <span class="arg">count</span> <span class="c">/* [IN] Number of sectros to read */</span>
|
||||
);
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<div class="para arg">
|
||||
<h4>Parameters</h4>
|
||||
<dl class="par">
|
||||
<dt>pdrv</dt>
|
||||
<dd>Specifies the physical drive number.</dd>
|
||||
<dt>buff</dt>
|
||||
<dd>Pointer to the <em>byte array</em> to store the read data. The size of buffer must be in sector size * sector count.</dd>
|
||||
<dt>sector</dt>
|
||||
<dd>Specifies the start sector number in logical block address (LBA).</dd>
|
||||
<dt>count</dt>
|
||||
<dd>Specifies number of sectors to read. FatFs specifis with 1 to 128. Generally, a multiple sector transfer request must not be split into single sector transactions to the device, or you may not get good read performance.</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="para ret">
|
||||
<h4>Return Value</h4>
|
||||
<dl class="ret">
|
||||
<dt>RES_OK (0)</dt>
|
||||
<dd>The function succeeded.</dd>
|
||||
<dt>RES_ERROR</dt>
|
||||
<dd>Any hard error occured during the read operation and could not recover it.</dd>
|
||||
<dt>RES_PARERR</dt>
|
||||
<dd>Invalid parameter.</dd>
|
||||
<dt>RES_NOTRDY</dt>
|
||||
<dd>The disk drive has not been initialized.</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="para desc">
|
||||
<h4>Description</h4>
|
||||
<p>The memory address specified by <tt class="arg">buff</tt> is not that always aligned to word boundary because the type of argument is defined as <tt>BYTE*</tt>. The misaligned read/write request can occure at <a href="appnote.html#fs1">direct transfer</a>. If the bus architecture, especially DMA controller, does not allow misaligned memory access, it should be solved in this function. There are some workarounds described below to avoid this issue.</p>
|
||||
<ul>
|
||||
<li>Convert word transfer to byte transfer in this function. - Recommended.</li>
|
||||
<li>For <tt>f_read()</tt>, avoid long read request that includes a whole of sector. - Direct transfer will never occure.</li>
|
||||
<li>For <tt>f_read(fp, buff, btr, &br)</tt>, make sure that <tt>(((UINT)buff & 3) == (f_tell(fp) & 3))</tt> is true. - Word aligned direct transfer is guaranteed.</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
<p class="foot"><a href="../00index_e.html">Return</a></p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,48 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
<link rel="up" title="FatFs" href="../00index_e.html">
|
||||
<link rel="alternate" hreflang="ja" title="Japanese" href="../ja/dstat.html">
|
||||
<link rel="stylesheet" href="../css_e.css" type="text/css" media="screen" title="ELM Default">
|
||||
<title>FatFs - disk_status</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="para func">
|
||||
<h2>disk_status</h2>
|
||||
<p>The disk_status function returns the current disk status.</p>
|
||||
<pre>
|
||||
DSTATUS disk_status (
|
||||
BYTE <span class="arg">pdrv</span> <span class="c">/* [IN] Physical drive number */</span>
|
||||
);
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<div class="para arg">
|
||||
<h4>Parameter</h4>
|
||||
<dl class="par">
|
||||
<dt>pdrv</dt>
|
||||
<dd>Specifies the physical drive number to be confirmed.</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="para ret">
|
||||
<h4>Return Values</h4>
|
||||
<p>The disk status is returned in combination of following flags. FatFs refers only <tt>STA_NOINIT</tt> and <tt>STA_PROTECTED</tt>.</p>
|
||||
<dl class="ret">
|
||||
<dt>STA_NOINIT</dt>
|
||||
<dd>Indicates that the disk drive is not initialized. This flag is set on system reset, media removal or failure of <tt>disk_initialize()</tt> function. It is cleared on <tt>disk_initialize()</tt> function succeeded. Media change that occurs asynchronously must be captured and reflect it to the status flags, or auto-mount feature will not work correctly. When media change detection feature is not supported, application program needs to de-initialize the file system object with <tt>f_mount()</tt> function after the media change.</dd>
|
||||
<dt>STA_NODISK</dt>
|
||||
<dd>Indicates that no medium in the drive. This is always cleared on fixed disk drive. Note that FatFs does not refer this flag.</dd>
|
||||
<dt>STA_PROTECTED</dt>
|
||||
<dd>Indicates that the medium is write protected. This is always cleared on the drive that does not support write protect notch. Not valid while no medium in the drive.</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
<p class="foot"><a href="../00index_e.html">Return</a></p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,68 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
<link rel="up" title="FatFs" href="../00index_e.html">
|
||||
<link rel="alternate" hreflang="ja" title="Japanese" href="../ja/dwrite.html">
|
||||
<link rel="stylesheet" href="../css_e.css" type="text/css" media="screen" title="ELM Default">
|
||||
<title>FatFs - disk_write</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="para func">
|
||||
<h2>disk_write</h2>
|
||||
<p>The disk_write writes sector(s) to the disk.</p>
|
||||
<pre>
|
||||
DRESULT disk_write (
|
||||
BYTE <span class="arg">drv</span>, <span class="c">/* [IN] Physical drive number */</span>
|
||||
const BYTE* <span class="arg">buff</span>, <span class="c">/* [IN] Write data (may be non aligned) */</span>
|
||||
DWORD <span class="arg">sector</span>, <span class="c">/* [IN] Sector number to write */</span>
|
||||
UINT <span class="arg">count</span> <span class="c">/* [IN] Number of sectors to write */</span>
|
||||
);
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<div class="para arg">
|
||||
<h4>Parameters</h4>
|
||||
<dl class="par">
|
||||
<dt>pdrv</dt>
|
||||
<dd>Specifies the physical drive number.</dd>
|
||||
<dt>buff</dt>
|
||||
<dd>Pointer to the <em>byte array</em> to be written.</dd>
|
||||
<dt>sector</dt>
|
||||
<dd>Specifies the start sector number in logical block address (LBA).</dd>
|
||||
<dt>count</dt>
|
||||
<dd>Specifies the number of sectors to write. FatFs specifis 1 to 128. Generally, a multiple sector transfer request must not be split into single sector transactions to the device, or you will never get good write performance.</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="para ret">
|
||||
<h4>Return Values</h4>
|
||||
<dl class="ret">
|
||||
<dt>RES_OK (0)</dt>
|
||||
<dd>The function succeeded.</dd>
|
||||
<dt>RES_ERROR</dt>
|
||||
<dd>Any hard error occured during the write operation and could not recover it.</dd>
|
||||
<dt>RES_WRPRT</dt>
|
||||
<dd>The medium is write protected.</dd>
|
||||
<dt>RES_PARERR</dt>
|
||||
<dd>Invalid parameter.</dd>
|
||||
<dt>RES_NOTRDY</dt>
|
||||
<dd>The disk drive has not been initialized.</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="para desc">
|
||||
<h4>Description</h4>
|
||||
<p>This function is not required in read only configuration. The specified memory address is not that always aligned to word boundary because the type of pointer is defined as <tt>BYTE</tt>. For more information, read <a href="dread.html">description in disk_read function</a>.</p>
|
||||
<p><em>Application program MUST NOT call this function while FatFs is in use, or FAT structure on the volume can be corrapted.</em></p>
|
||||
</div>
|
||||
|
||||
|
||||
<p class="foot"><a href="../00index_e.html">Return</a></p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,62 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
<link rel="up" title="FatFs" href="../00index_e.html">
|
||||
<link rel="alternate" hreflang="ja" title="Japanese" href="../ja/eof.html">
|
||||
<link rel="stylesheet" href="../css_e.css" type="text/css" media="screen" title="ELM Default">
|
||||
<title>FatFs - f_eof</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="para func">
|
||||
<h2>f_eof</h2>
|
||||
<p>The f_eof function tests for end-of-file on a file.</p>
|
||||
<pre>
|
||||
int f_eof (
|
||||
FIL* <span class="arg">fp</span> <span class="c">/* [IN] File object */</span>
|
||||
);
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="para arg">
|
||||
<h4>Parameters</h4>
|
||||
<dl class="par">
|
||||
<dt>fp</dt>
|
||||
<dd>Pointer to the open file object structure.</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="para ret">
|
||||
<h4>Return Values</h4>
|
||||
<p>The <tt>f_eof()</tt> function returns a non-zero value if the read/write pointer has reached end of the file; otherwise it returns a zero.</p>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="para desc">
|
||||
<h4>Description</h4>
|
||||
<p>In this revision, this function is implemented as a macro.</p>
|
||||
<pre>
|
||||
<span class="k">#define</span> f_eof(fp) (((fp)->fptr) == ((fp)->fsize) ? 1 : 0)
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="para comp">
|
||||
<h4>QuickInfo</h4>
|
||||
<p>Always available.</p>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="para ref">
|
||||
<h4>See Also</h4>
|
||||
<p><tt><a href="open.html">f_open</a>, <a href="lseek.html">f_lseek</a>, <a href="sfile.html">FIL</a></tt></p>
|
||||
</div>
|
||||
|
||||
<p class="foot"><a href="../00index_e.html">Return</a></p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,62 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
<link rel="up" title="FatFs" href="../00index_e.html">
|
||||
<link rel="alternate" hreflang="ja" title="Japanese" href="../ja/error.html">
|
||||
<link rel="stylesheet" href="../css_e.css" type="text/css" media="screen" title="ELM Default">
|
||||
<title>FatFs - f_error</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="para func">
|
||||
<h2>f_error</h2>
|
||||
<p>The f_error tests for an error on a file.</p>
|
||||
<pre>
|
||||
int f_error (
|
||||
FIL* <span class="arg">fp</span> <span class="c">/* [IN] File object */</span>
|
||||
);
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="para arg">
|
||||
<h4>Parameters</h4>
|
||||
<dl class="par">
|
||||
<dt>fp</dt>
|
||||
<dd>Pointer to the open file object structure.</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="para ret">
|
||||
<h4>Return Values</h4>
|
||||
<p>Returns a non-zero value if a hard error has occured; otherwise it returns a zero.</p>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="para desc">
|
||||
<h4>Description</h4>
|
||||
<p>In this revision, this function is implemented as a macro.</p>
|
||||
<pre>
|
||||
<span class="k">#define</span> f_error(fp) (((fp)->flag & FA__ERROR) ? 1 : 0)
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="para comp">
|
||||
<h4>QuickInfo</h4>
|
||||
<p>Always available.</p>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="para ref">
|
||||
<h4>See Also</h4>
|
||||
<p><tt><a href="open.html">f_open</a>, <a href="sfile.html">FIL</a></tt></p>
|
||||
</div>
|
||||
|
||||
<p class="foot"><a href="../00index_e.html">Return</a></p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,51 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
<link rel="up" title="FatFs" href="../00index_e.html">
|
||||
<link rel="alternate" hreflang="ja" title="Japanese" href="../ja/fattime.html">
|
||||
<link rel="stylesheet" href="../css_e.css" type="text/css" media="screen" title="ELM Default">
|
||||
<title>FatFs - get_fattime</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="para func">
|
||||
<h2>get_fattime</h2>
|
||||
<p>The get_fattime function gets current time.</p>
|
||||
<pre>
|
||||
DWORD get_fattime (void);
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="para ret">
|
||||
<h4>Return Value</h4>
|
||||
<p>Currnet time is returned with packed into a <tt>DWORD</tt> value. The bit field is as follows:</p>
|
||||
<dl class="ret">
|
||||
<dt>bit31:25</dt>
|
||||
<dd>Year from 1980 (0..127)</dd>
|
||||
<dt>bit24:21</dt>
|
||||
<dd>Month (1..12)</dd>
|
||||
<dt>bit20:16</dt>
|
||||
<dd>Day in month(1..31)</dd>
|
||||
<dt>bit15:11</dt>
|
||||
<dd>Hour (0..23)</dd>
|
||||
<dt>bit10:5</dt>
|
||||
<dd>Minute (0..59)</dd>
|
||||
<dt>bit4:0</dt>
|
||||
<dd>Second / 2 (0..29)</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="para desc">
|
||||
<h4>Description</h4>
|
||||
<p>The <tt>get_fattime()</tt> function must return any valid time even if the system does not support a real time clock. If a zero is returned, the file will not have a valid time. This fucntion is not required in read only configuration.</p>
|
||||
</div>
|
||||
|
||||
|
||||
<p class="foot"><a href="../00index_e.html">Return</a></p>
|
||||
</body>
|
||||
</html>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user