|
EDA365欢迎您!
您需要 登录 才可以下载或查看,没有帐号?注册
x
自己移植的SD卡的FATFS文件系统,采用最新版FATFS R0.09,并且有详细的中文注释,和操作测试程序,完整的MDK STM32F103工程。下载即可使用。
l2 x t2 V0 v2 ?/*----------------------------------------------------------------------------/
$ @4 J& w8 t7 {/ FatFs - FAT file system module R0.09 (C)ChaN, 2011
6 A; Z. ]) y8 h6 V: k/-----------------------------------------------------------------------------/
) d1 ~- _" K6 A! G! y/ FatFs module is a generic FAT file system module for small embedded systems.
0 V& X$ J0 z: G) H4 R3 P/ This is a free software that opened for education, research and commercial
0 t- A3 z$ x& w9 F6 r" A1 Q8 T& @/ developments under license policy of following terms.
' _: } i2 N* p; N4 n" |* S$ q; Z/
! P2 L/ }+ t* x: B/ Copyright (C) 2011, ChaN, all right reserved.
& \4 ^5 E/ S* P/ d/0 |! H+ o' c5 T3 _. V: t5 b
/ * The FatFs module is a free software and there is NO WARRANTY.
: s$ p6 U$ k3 A! Y3 V/ * No restriction on use. You can use, modify and redistribute it for
4 v/ B' }0 `% m/ personal, non-profit or commercial products UNDER YOUR RESPONSIBILITY.
1 q+ ]- E/ U7 B& W2 z7 I/ * Redistributions of source code must retain the above copyright notice.
; i+ i8 V' A) Y, p+ A+ i# q* r k4 e' w/
. `' j+ L, |: d0 M/-----------------------------------------------------------------------------/
* y! E- ]' S/ C- u& T
* Y! i9 h- m: H! p7 W& j4 c" H- c C& H4 W5 v2 Z
/*--------------File Info-------------------------------------------------------
' R6 t a G- Z6 t** 文 件 名: FATFS_Function.c; [$ e% J. @3 ~3 Z7 }4 E
** 作 者:~风中的叶~ 整理6 @4 G$ |0 H+ O8 }* \% d
** 最后修改日期: 2012.01.18
$ D( i J* o8 K* f! D* P9 _; k: t** 版 本: V1.0. f1 K: ]2 S. Y. d9 C
** 描 述: FATFS常用功能测试函数 .连接PC机串口,观察超级终端输出
. w* V0 n# R. `**------------------------------------------------------------------------------& N; _4 D t- V9 U% f
** Created by: Dt.! g' y) Q' x3 I) k( a( f
** Created date: " ^6 l; c9 q4 s- a" y% j( d
*******************************************************************************/ . Q3 x% k" H0 z2 J1 {- z3 M: Z
#include "TEST_FATFS.h"
6 T. Q* k7 _$ f! R8 ~6 R |/ T#include "string.h"
+ d% [. b& C! f) i3 u7 {% V4 L1 f* p+ M1 Q0 @; p d3 e
#ifdef TEST_FATFS_EN! G: S0 Q9 p% i( t) F
3 X8 u& d7 n, B+ b
, ?, g* d" }9 X' }& V. L8 T. k. d
% r6 ]; M5 W; T z//检测磁盘是否插好
" c) M5 g& u9 d9 U0 OBOOL disk_detect_OK(void)7 C# s4 g, q5 j! Y$ q
{8 ?; Q+ y3 r n9 {6 b* r
if( disk_status(0)==STA_NODISK )/* Physical drive nmuber (0..) */( H& P! q2 Z2 r9 \) F E
{5 R! U& W/ H2 |" a( k
printf("\r\n\r\n%48s\r\n","<未检测到磁盘,请检查SD卡是否插好...>");! q, y o# J1 S- _5 S( E. T: p7 b
return FALSE;
* a8 U0 w) m4 B6 l' {/ |) F }; K& m6 f) z! l' E( v" x
return TRUE;
1 Y7 F* e* S3 D' o3 ^}
" ^1 `1 n5 b1 I# {5 D
& |+ V6 A" N+ B+ u* V
i% T2 J A! u3 o+ h( n
% m' j/ M/ V* f& v1 h7 j4 S$ f//测试函数执行结果分析, \3 k, O7 E3 U; T3 J% u
void die(FRESULT res)
* {6 j% n* [% Z3 j1 S3 J9 s{
7 e) O' i; k, t& b4 ? switch(res)
2 n7 o) c# X A K5 l. C Z {
7 M) Q& p3 ~. r, L( ^ case FR_OK: //The function succeeded.
7 s, v7 f/ k, k9 f: e {
2 k8 |- G, {' n: \ printf("\r\nThe function succeeded!\r\n");
" O% ?7 l' |$ _: Q+ w" ~ break;
7 P+ J8 S1 d) Y* B }
. J1 _) J, j" t case FR_NOT_READY://The disk drive cannot work due to no medium in the drive or any other reason/ i8 c; S1 U6 l0 m; i- n
{
* O0 \% C4 h$ i& T printf("\r\nThe disk drive cannot work due to no medium in the drive or any other reason!\r\n");
* `5 Y: ~, y' U& L8 _ break;
1 N' q+ m+ |6 k; |8 N1 G V) N }
, J3 l% z. M6 _: u% x1 O3 @ case FR_NO_FILE://Could not find the file.5 m# H' Q4 `/ u+ ?$ r
{! U* O2 ^% k# f
printf("\r\nCould not find the file!\r\n");- M* |% ^- a' |9 T$ z. b
break;" H% ^4 B( E! J& U: C* S' Y
}* g, V6 k# }2 f' {" b' N' I
case FR_NO_PATH://Could not find the path! y4 I; h2 P2 k, q, Z% k
{
9 t! B, a& P" Y; \$ ^* W" T printf("\r\nCould not find the path!\r\n");; k7 z% |" d4 b8 G# s1 S
break;/ q7 g, g: i5 P" `: m# I, ^; Z
}
, [9 J8 E3 l7 P! K case FR_INVALID_NAME://The path name is invalid
9 y" P0 a- ?& c1 T {4 A* g# R/ v; x2 w9 j9 g; ~
printf("\r\nThe path name is invalid!\r\n");
# q- t& B* w8 o break;
' b6 t) q8 [. U" d }
6 S; k0 r5 `! E3 {# G# } case FR_INVALID_DRIVE://The drive number is invalid
# Y! T8 a- R+ @, b3 l B& M0 a2 ` {
8 _. M1 I4 t3 v+ i- N8 N printf("\r\nThe drive number is invalid!\r\n");2 t. C2 e! A2 x1 u& C1 ]
break;, R6 G1 C2 U* P' w+ t+ n
}! Y. v7 k7 f, \" p
case FR_DENIED://The directory cannot be created due to directory table or disk is full.
+ {. N$ [" }5 `& X# o- R {
' D2 U, C8 [ h+ s5 Z7 s printf("\r\nThe directory cannot be created due to directory table or disk is full!\r\n");, ]1 J ]- e- L
break;8 m/ A; {& [2 h3 o+ P
}
) w& t1 y% E. Q5 S case FR_EXIST://A file or directory that has same name is already existing7 } u* b7 [+ ]& p
{& ~' J* {& N" N8 `
printf("\r\nA file or directory that has same name is already existing!\r\n");' @9 p6 W$ t4 o+ ?8 e: d
break;
& ~" `9 H9 j# ?' {, k7 | }7 q( |8 W- f7 |/ G+ I" ^* ~
// case FR_RW_ERROR://The function failed due to a disk error or an internal error
D4 d: U6 Q" X3 q/*
$ ]2 Q2 k/ ^* t: S, j R case FR_RW_ERROR://The function failed due to a disk error or an internal error
. ]1 r# ~. S) l0 R- w {
9 E9 O' _$ s5 A) T. i! Z printp("\r\nThe function failed due to a disk error or an internal error!\r\n");) @9 L; x$ O- Z4 T0 b( G
break;6 y ?2 q6 m8 T4 h
} o1 l. Y$ r' a2 I" S
*/
i: B: Q6 N( J- y) p case FR_WRITE_PROTECTED://The medium is write protected
) k) o, i0 Z3 q) |( m4 k {
9 m; o: F, o! }0 O3 q printf("\r\nThe medium is write protected!\r\n");2 ]# ~$ ^4 P$ `+ u! B
break;% \& t# C; [6 J0 a
}
' D& U8 H3 X6 f. n case FR_NOT_ENABLED://The logical drive has no work area
1 R! M# l' {3 f' W* E5 ^; s {
Q! K/ A1 T# {( c( _( C6 J4 F printf("\r\nThe logical drive has no work area!\r\n");. s( X! n. m/ ~5 S2 a: x
break;
* J1 F0 N) Y* _. i4 i7 j. \ }
. O, S, Z7 _# g) }- \- h/ \ case FR_NO_FILESYSTEM://There is no valid FAT partition on the disk
% E- e6 J% o! j5 V; j9 k6 h {
. p7 r; k1 U5 Y; e/ {# W printf("\r\nThere is no valid FAT partition on the disk!\r\n");8 p2 r9 C+ i+ z3 h
break;
& ?* i; H1 ~% g0 l; y' U } S- k) F0 g, W4 B0 \
case FR_INVALID_OBJECT://The file object is invalid
; ]1 n8 K) _6 n* K {. [3 o3 _+ z5 B9 x, c* |+ A$ x; |/ ^
printf("\r\nThe file object is invalid!\r\n");
8 n9 g: j3 P) _$ l1 ]6 N break;& ?6 X) R$ R2 z D0 Z; j! u, }
}* Q7 ^2 H3 R" J
4 ], L; Q* G% Z$ P3 L8 Z //The function aborted before start in format due to a reason as follows. $ |) B% d% E6 h3 G5 Y
//The disk size is too small.
. a/ T/ N. f4 |$ k/ {6 z% w //Invalid parameter was given to any parameter. 0 D- D& w, Z+ A5 G3 K5 d
//Not allowable cluster size for this drive. This can occure when number of clusters becomes around 0xFF7 and 0xFFF7.
& ~" O4 c: e @: L& m! V case FR_MKFS_ABORTED://. ^2 I3 r, i& E8 D
{
1 d0 v" V3 w" D' ?5 X. M$ S printf("\r\nThe function aborted before start in format!\r\n");
1 a# G' e+ X6 }! O4 U break;
6 s$ r \+ z# a6 P+ h+ w8 q }
# m: I7 b2 s# x/ h }- I6 n; r / x4 o6 s( S; j- w( {5 d+ ]3 v
default:
& [9 U; }7 E6 C# c {/ R5 [$ c# V/ v! K( o
printf("\r\nerror!\r\n");4 p, l1 d- i# F5 A- ^$ J3 W
break;
5 {( X9 ?& }) g- h- n( h }
" Y% }" @5 R) a6 t }* l6 v- U% b2 ]) x
return;
S# L4 e; c3 Z n/ z! @4 W+ H8 ?}/ z% {9 s) Y! B5 q
void Test_f_getfree(void)//获取卡的总容量及剩余容量
- G: h( @3 S9 p3 l9 v/ K{5 [8 f! \5 U4 G" P& t
FATFS fs;
( _, a: N2 o" H& J8 I FATFS *pfs;- m) E9 W$ P: i5 H
DWORD clust;( ]3 p, U5 z; l/ {( N( O9 v3 H
FRESULT res; // FatFs function common result code0 o5 E. @( f( u+ g
& l/ Z4 m7 u/ b/ F
//检测磁盘是否插好& N: e/ W7 i. M" a" S/ ?
if( disk_detect_OK()==FALSE ) return;7 {5 e; m' k) L# @9 P# y, E
: H8 R7 C$ B. y' ] pfs=&fs;//指向
: F3 a0 ~7 H: z+ }/ {0 V // Register a work area for logical drive 0/ a# @- _7 ~2 U* ?
f_mount(0, &fs);//安装FATFS,就是给FATFS分配空间6 h: c2 t$ g3 Y( \; ?( o2 _
( E' h% `+ }( {- T' H ~6 _
// Get free clusters- o# y$ e; C, N
res = f_getfree("/", &clust, &pfs);//必须是根目录,默认磁盘0;"/"或者"0:/"( `- n* P0 |: I3 m6 @9 U
if ( res==FR_OK )
. Y8 x/ C$ c8 @8 h: z/ G( Q {( n: i9 ~; R8 f# O
// Get free space
r2 t0 |# H( U printf("\r\n%d MB total disk space.\r\n%d MB available on the disk.\r\n",( H1 a D; t( t$ K6 } ^8 J9 G; A. _
(DWORD)(pfs->n_fatent - 2) * pfs->csize /2/1024,//总的磁盘空间M =(总簇数-2)*每簇的扇区数/2/1024=可用簇数*每簇的扇区数/2/1024
5 p6 v2 y5 J. X2 z+ j2 M clust * pfs->csize /2/1024);//空闲的磁盘空间M=剩余簇数*每簇的扇区数/2/10244 \" q4 l* C- R8 x9 F
}
$ x/ S, v" t9 D else die(res);//测试函数执行结果分析
+ [/ w* W1 f m' m) k
9 {3 p% b5 q& U; x/ y# y! B // Unregister a work area before discard it
9 o: ~2 T6 t6 Y+ s/ e2 [: @4 L f_mount(0, NULL);//卸载FATFS,就是释放FATFS结构体所占空间
- j, t' c6 F) X i" w2 t, @}; b, G% J' m* G# @! J; u/ C
# V4 I) X8 @0 nvoid Test_f_read(void)//读文件的数据,如果没有此文件则返回错误2 f4 E0 G6 [& C0 `" x: i
{7 @ A+ B, J1 K' l0 {# Q# b! C/ X
FATFS fs; // Work area (file system object) for logical drive
) @# |+ R6 v% ^- F" e% S( N FIL fsrc; // file objects
3 G# F5 o$ v6 w4 ] BYTE buffer[512]; // file copy buffer
. A7 d8 _* ~/ `) G FRESULT res; // FatFs function common result code1 n @3 t, P" u' f0 u$ @; y
UINT br; // File R count
% `# ?( i9 y& `: `- d6 b u16 i;
- c% X1 C4 E. T' B, D) |
# f9 _2 z) G( }- V
5 _6 ?9 V8 r) g% X% G char path[20];
! i5 I7 G/ \ S; U5 H) q: _
8 Q/ `9 T2 P7 d# ^ //检测磁盘是否插好# J% Z) w2 R1 A
if( disk_detect_OK()==FALSE ) return;
3 l, |6 v$ Q; i8 q5 [3 ~" \$ r
, G; q7 I" |' i8 _& X2 h$ A6 W, \ // Register a work area for logical drive 0
' G( y% z% l% D/ m6 V/ ?" I" d4 Y f_mount(0, &fs);
3 ?# L2 u# u( {7 k
+ o! l( o; B" \ printf("\r\nread file:>");
* a0 P9 o7 m% E& J2 n3 k USART_Scanf_Name(path);//通过串口输入文件路径名/dir/file.txt或者0:dir/file.txt或者0:/dir/file.txt
8 q( M+ B! V4 d j( U& h' I# t( i N* E6 S$ W; B3 l& _- l
//Open source file, N& K% c: w2 \
res = f_open(&fsrc, path, FA_OPEN_EXISTING | FA_READ);//打开存在的文件,如果没有则返回错误! ?5 \. F6 S( X
die(res);3 v4 a2 ?1 q s/ I) V! l1 i: s
- O. X# Z7 l& o
//buffer空间设大一点,会提高读的速度。
; S1 L1 u7 T8 L. `6 N* l //如果文件实际大小512byte,, o$ I) {6 r! S) C; z
//设为buffer[512]时,只需要循坏一次,如果设为buffer[1],需要循坏512次。% Q" U. [) d; D8 ` F2 j6 _
//下面两行主要是去除1s误差。
. l3 L+ A! Y/ O9 Q, j3 ]0 [8 a# \4 R! }
for (;;) $ S" s( c! ?0 S2 t: H( P
{
' N; F* ?. X9 l: Y _$ V% o2 Z. ^ for(i=0;i<sizeof(buffer);i++) buffer[i]='\0';//清除缓存
$ W; V# C5 F3 r+ m
2 P6 |3 x1 l$ E, V, O. { res = f_read(&fsrc, buffer, sizeof(buffer), &br);
% Y1 X1 l0 @! d& c+ _9 ? if (res ||(br == 0)) break; // error or eof
% X* G: i+ Y) h# `
' Z8 U& N( ?7 E printf("%s",buffer);
7 D% {+ c& \+ w }8 U( M! Z9 Z+ I/ A3 T
6 ~, t' j2 `! k# Z : p4 X5 ?2 i+ j( |6 R
// Close all files3 h6 r h0 |2 Z* F1 g. x" K
f_close(&fsrc);
, c7 ~; c7 `* L- S/ _ // Unregister a work area before discard it$ D% J [3 S! W( J# z- V+ C
f_mount(0, NULL);, c2 l6 A5 Y! ]7 N- P' L
}
/ n6 C9 u6 T; J6 _
( I, D8 L; w, yvoid Test_f_write(void)//写数据到文件,如果没有此文件则创建文件
" Z: B0 ~ ^+ p) j{
4 A/ v; a2 m" I1 z9 n* Y FATFS fs; // Work area (file system object) for logical drive
: l2 o m3 U" _2 \# u) T FRESULT res; // FatFs function common result code: R' U n3 c5 y; q; D& V
FIL Make_file;! |. P+ O* t! P2 ]
char file_name[20];
; t& [ i" Z& N1 g/ p! M8 s! D char Storage_buffer[] ="0";
+ g) W5 p9 ~; f n% g2 S 1 E' P' ?* D3 p* T9 X
UINT bw;. x& _) {; p; a3 e5 B n3 v
//检测磁盘是否插好
: N: B* o( ~7 B: @: y! r7 {5 Z. f if( disk_detect_OK()==FALSE ) return;
6 \/ ~5 s$ G, D# b+ w1 Y printf("\r\n inaert_ok:>");1 e9 i: y- B) J8 F6 |
// Register a work area for logical drive 0
* X2 J2 D6 n) S! E" d% w f_mount(0, &fs);
) M% [* W' u- y4 `8 Q
; O% p0 Q3 U+ Y( i. r printf("\r\n Make file Name:>");
6 }. E( f a" J k0 K3 s USART_Scanf_Name(file_name);//通过串口输入源文件路径名/dir/file.txt或者0:dir/file.txt或者0:/dir/file.txt
. e! R! b* x) l9 q# T) |9 h1 Q( X& L/ }/ ]
res = f_open(&Make_file, file_name, FA_OPEN_ALWAYS | FA_WRITE); //可写方式打开 没有文件则创建
. s# K8 U. \$ k5 k. y( D printf("\r\n open_ok:>");: P% b5 G4 ~' X' U
die(res);* h# I: O" B$ }
res = f_lseek(&Make_file, Make_file.fsize); //指针移到文件最后
2 z. r7 f. x! f% Z3 F. {$ t+ l+ N printf("\r\n seek_ok:>");
& m" F1 z- F) j2 ]( @, E( W O die(res);
) R }. B6 R( s2 G1 o2 Q( ^ res = f_write(&Make_file, Storage_buffer, (sizeof (Storage_buffer))-1 , &bw); //每次需要写入的数据字节数,去掉最后的\0所以-1
- ~) s+ f; H L" \# y* W8 O printf("\r\n write_ok:>");: g# z" e$ v R& C) i
die(res);6 {* U1 r8 N; Z$ x# k/ U
res = f_lseek(&Make_file, Make_file.fsize); //指针移到文件最后 / ]. e; u1 r5 m2 x5 _0 w1 B
f_close(&Make_file);//关闭文件1 ^& F5 _4 p% }
printf("\r\n close_ok:>");
6 Y5 z# |7 k4 W6 }% H1 ~3 O* B; m7 R0 |' r, d% E6 o8 e) X, a3 o
printf("\r\n写文件测试OK!\r\n");+ c( w+ c$ U$ \& z/ ~" ?
; f; y7 N2 l( f* j. h0 U& `$ o
// Unregister a work area before discard it
! e% A! q, G- U+ p1 U& ^- j6 u. k1 P f_mount(0, NULL);
! C1 c1 p8 [6 k/ o9 @! I}
5 F7 c f2 S1 v: E7 y4 @1 d! @" J" Q$ o% r4 A/ @0 l
//The f_read function reads data from a file.
9 G4 w; H4 C& P) E: t6 v//在RAM里面调试这个程序的时候,总出现莫名其妙的错误,最后怀疑是堆寨溢出了,证明果然是这样! i( p! X/ p$ z+ W/ F
//把Stack_Size EQU 0x00000400 改为 Stack_Size EQU 0x00000800就正常了
! R! @) X" {+ J& R) ^+ s% E D//所以以后要特别注意这个问题。
* L1 f4 j& V; u# f y
! f8 c6 i1 z N. m7 j1 @1 du8 StrToData(u8 * data, u8 len)
- p8 c: M5 e; o5 g. c, v5 j! f{5 w: Q+ S- I* ?6 J2 |1 i/ T7 s
u8 ltemp;4 c/ U; q# t; Y. `! L+ D
if(len == 1)7 v' n2 } O& K2 z; _* {
{
! C4 ?1 ?4 g X3 f ltemp = data[0]-0x30;) F9 R1 R0 a4 e
/ f- z6 x6 f9 X% h; S
}) O0 d/ v$ \# Q/ _3 ~- C, G8 f
else if(len == 2)) h6 O/ v, u$ @! g6 u$ |! [/ r$ G4 |
{
1 y! ]! O Q: [1 S# f! H4 o ltemp = (data[0]-0x30)*10 + (data[1]-0x30);& E6 \4 w8 M8 u# o: x# _9 t
6 r% W! J8 @$ W8 { }
1 H) u3 p. V# e. |- n( ^ ] //else if(len == 3)
( r! \9 U; f. [# Z6 { //ltemp = (data[0]-0x30)*100 + (data[1]-0x30)*10 + [data[2] - 0x30];' r3 ~; [0 k9 W2 Z& C
+ `) j7 U2 P4 C, B
return ltemp;
# s" E9 C( r" B6 s. ^0 t
9 Q5 a; J. g% o0 h9 ~0 n2 U& Q2 k8 C}+ i4 u9 W' q" }2 x! I$ G6 Z
4 L K& q S! E5 \
# A& ^2 F9 j- E/ ?, I#endif
; R% Z7 m* f% V3 J. I( S) x; s7 O, j \4 L- W5 f, ]; B
* d- u- X$ O( S/*; Q/ f! F( P0 F& }) S6 l
int main(void)0 K, {* w( p3 N" S9 X
{/ J" n# r- v; A% @8 q
///////////////////////////////////////////////////////////* V4 ]5 Q8 s) Q* @9 u& ]) d, M2 ~1 j& N
UART1GPIO_config();//串口IO口配置
- y/ X+ ]2 Q; {& P& Z9 _USART1_config();//串口初始化波特率为19200
. W" o7 p0 n6 _, R7 H//UART1NVIC_config();//配置中断
& w: G) ?4 Z! j/ u7 `///////////////////////////////////////////////////////////
2 j3 C0 V5 i4 ]! e! dSDCard_SpiInit();//SD卡的IO口及SPI模块初始化,PA2插入检测(H—>L)A3 CD_CS片选;PA5 SCK;PA6 MISO;PA7 MOSI;低速模式
0 M1 Q; l) D% f2 o1 Y t7 H//SD_Init();//SD卡初始化,如果使用的FATFS则可以不用这句,因为FATFS在打开文件等操作时已经调用了它
/ c% I/ S6 r$ u/ T& F. R3 ^Test_f_getfree();//获取SD卡的容量和剩余容量
7 K( X, H) R7 G9 S/ v$ LTest_f_read();//SD卡读文件测试
2 C( B) G! U) x2 t. |Test_f_write();//SD卡写文件测试
5 v2 U! L) u$ F# A7 n$ C///////////////////////////////////////////////////////////
3 N3 C x _% R& @& [: [ while (1)' P& V! Z. {# Q2 {
{
4 k/ ]8 t% K: }5 q //printf("好的");0 G7 G6 ?1 S( ]% f
}$ ~1 }4 p+ _2 Z- ~
}*/. Y; j7 i9 P( @" S' M. T+ X/ Y
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
# w. L7 |/ S3 [FRESULT Test_f_mkfs(BYTE drv)//对卡进行格式化,驱动器号一般为0" r( b& ^2 e# J
{
+ f6 S6 T5 k9 t8 r1 ]& U! r4 b9 l FATFS fs; // Work area (file system object) for logical drive& `8 k0 R% d6 {. I4 r8 `
FRESULT res; // FatFs function common result code
* J1 x) }0 o( ?) u- C8 `" G7 D3 f
7 A7 V/ D6 y+ k& k //检测磁盘是否插好* ]8 Z& f4 i! v1 n. A: k8 U
//if(disk_detect_OK()==FALSE ) return ;
3 P* L2 a' \% `" J# } //printf("\r\n inaert_ok:>");: S* Y" A4 q1 W0 d8 P; o3 ]
// Register a work area for logical drive 0
8 h) }! U+ U0 Y ? f_mount(drv, &fs);9 W& E1 _2 { n6 h8 Y* n
res=f_mkfs(drv, 0, 0);/* Create a file system on the drive 在驱动器创建一个文件系统(驱动器号,分区规则(0:FDISK, 1:SFD),分配的单元大小)*/
( R+ _$ U L2 [9 X7 {5 K0 S //die(res);4 N' W2 h+ a P! x
f_mount(0, NULL);
5 T0 M7 \/ e! l1 o: ]' Z9 S return res;
7 R G; r j8 D# F6 @4 j}
1 a1 Q3 X {2 Q9 W Y) G////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////. @! i2 r5 u: W$ q5 B$ {. ^
FRESULT Test_f_mkdir(const TCHAR* path)//创建一个新目录,输入目录的路径Test_f_mkdir("/dir");只能一级一级的建立目录 , i+ b! c4 B8 S" `7 p
{
) ^: { q" u2 I FATFS fs; // Work area (file system object) for logical drive5 \4 v, `' }8 G! [! v" q8 B% T1 j# w
FRESULT res; // FatFs function common result code) G0 Y ]4 w9 W6 w k+ O0 y$ K
4 t& J, T4 z+ _2 v //检测磁盘是否插好4 g7 I3 w/ T6 m9 m3 E% X! l5 V
//if(disk_detect_OK()==FALSE ) return ;/ D( y: ]& J2 d9 `% h
//printf("\r\n inaert_ok:>");
. B5 T: ]3 n. `+ L9 }* F$ L // Register a work area for logical drive 0
0 n; [# `, P) I3 E8 K0 C% b7 A% B3 N f_mount(0, &fs);3 ], J$ o: q X7 I" k- j) R
res=f_mkdir(path);//创建一个新目录
: x3 F- H) H! U. U5 {9 o //die(res);* j9 K. `* m% r8 ^8 Q" i
f_mount(0, NULL);$ H' z2 l, a& s. r+ j! c
return res;
3 b/ x" t! V! E5 [}
' J [6 j, a2 s2 L/ u' [% z" @////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////' L. |' y' \% g4 w
FRESULT Test_f_deldir(const TCHAR* path)//删除一个目录,输入目录的路径;目录里的内容是空的才能删除Test_f_deldir("/dir");
% M2 \+ K5 |7 D5 u{) U3 V. M2 X6 e, N+ r
FATFS fs; // Work area (file system object) for logical drive) [" [4 f3 e+ ?
//DIR dir;
3 O y! a4 S, L7 G; f' }+ f FRESULT res; // FatFs function common result code
2 x, C; @. w- Q/ K- T r* o. ~: E' e
1 R& ?; }" E0 T% k //检测磁盘是否插好2 W+ |9 b; Q4 s7 d6 h8 h3 g
//if(disk_detect_OK()==FALSE ) return ;
/ t2 v. ^- v6 i' m' j+ _ //printf("\r\n inaert_ok:>");
6 j4 F, Q/ G/ @4 K% e6 b1 Z1 y // Register a work area for logical drive 0. h" z; q7 q, Y; G6 v" v# n5 f- J
f_mount(0, &fs);
+ i2 X: e( G; P+ A6 E/ C1 q/ I r //f_opendir (&dir,path);
$ E- e9 N$ X2 W+ f+ S0 X; x( u res=f_unlink(path);//删除一个目录
; V2 k5 @/ b0 U7 ^ //die(res);
: b$ s' T# F* i% @ f_mount(0, NULL);, M6 L' q1 O/ u) V+ E0 t+ T
return res;
6 G; p" W( k% P% V4 a}
/ { K9 T, ?1 N# Y& g/ {. m7 W////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
t! a: ?9 h1 m1 zFRESULT Test_f_readdir(const TCHAR* path,char (*filename)[13])//获取目录中的文件,输入目录的路径;输出文件名和文件夹名Test_f_readdir("/DIR",name);char name[5][13] ) |9 e! q) q! n- D9 N- s- x }3 \! F
{
" o% t R. Y% L+ [3 ]* b, h$ j( E% Z% q FATFS fs; // Work area (file system object) for logical drive
H d7 D1 j, v; @, g DIR dir;
7 C- `0 ?0 Z# W. H FILINFO finf;% u E/ F6 ?0 F9 Y; k4 h; O
FRESULT res; // FatFs function common result code: W1 R0 c; C) q
, S! b7 F, s6 u# z- k //检测磁盘是否插好 K1 b9 s, i# |% z
//if(disk_detect_OK()==FALSE ) return ;
; B: E, T# C' Y2 f //printf("\r\n inaert_ok:>");: p% @/ u1 g1 v8 K
// Register a work area for logical drive 0
; p8 Z# @, i6 v7 [ f_mount(0, &fs);) {8 n1 ^: o0 q1 o4 _
f_opendir (&dir,path);) P# p6 s0 w5 y; B/ E5 S
; p+ @/ w0 F- d4 `& i
while(((res=f_readdir(&dir,&finf))==FR_OK)&&(finf.fname[0]))//获取目录中的文件 2 G. h0 d' X _
{strcpy(*(filename++),finf.fname);
5 F! y4 B" D+ R8 }% a2 T1 z //printf("%s",finf.fname);
7 o0 N3 e! V$ a/ |8 n1 k5 ~ }
5 G) p! }$ w, l2 E* ?7 Z //die(res);
3 V# D/ `) N7 t4 `2 q3 R5 z# M9 w+ l f_mount(0, NULL);; m, N5 J8 u! k5 s+ m
return res;
- S/ A% i" ?" _5 [$ H0 {9 G2 q}
) f, O% d7 D) o0 m- s////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////( @" s1 }4 \" g
FRESULT Test_f_creat(const TCHAR* path)//建立文件,输入文件路径和文件名2 j# h( P& n* M+ A
{8 E) |& P: F9 O+ O1 d
FATFS fs; // Work area (file system object) for logical drive' D, R( v: c: y5 @9 \4 _" H+ C6 q
FIL file;3 G0 L/ b: d8 g4 v0 N( p0 e
FRESULT res; // FatFs function common result code, \) I M! o2 y5 Q3 N) ]. ?
8 z: Z, I& u' w6 t7 v) J
//检测磁盘是否插好# Q( d$ `1 N( e
//if(disk_detect_OK()==FALSE ) return ;
& V! I' A7 g9 C9 W) u1 H6 P //printf("\r\n inaert_ok:>");
; k# F- s7 \& e4 p A+ u1 E // Register a work area for logical drive 0$ w" V& w; V+ s' L
f_mount(0, &fs);
* u! f! o, ~1 T5 ]0 f* h- u1 r res=f_open(&file,path,FA_CREATE_NEW); //创建一个新文件。如果文件已存在,则创建失败//FA_CREATE_NEW创建一个新文件。如果文件已存在,则创建失败。9 |* p) h4 | h. w/ C5 F. u+ i
//FA_CREATE_ALWAYS //创建一个新文件。如果文件已存在,则它将被截断并覆盖。0 b: ~* w& s8 Q$ i5 N6 m
//FA_OPEN_ALWAYS //如果文件存在,则打开;否则,创建一个新文件。9 S0 q5 b9 z5 P* q2 o+ d+ C
//die(res);
- N7 _6 i/ H4 w$ s" v+ g f_close(&file);//关闭文件# t: \1 b+ P b; w+ }
f_mount(0, NULL);
0 X$ f0 Q- r' U# L) G+ a return res;- d: @2 k$ _4 t8 @8 G8 Q& q
}& @; A; _( C L/ G2 E, X
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
% d: Y$ H" b& M8 \4 SFRESULT Test_f_delfile(const TCHAR* path)//删除一个文件,输入文件的路径;Test_f_delfile("/dir"); % v" U, \ p& r; a: i5 U
{ T5 O$ K2 }/ c* ~7 y% W
FATFS fs; // Work area (file system object) for logical drive- u' u9 f+ z% U( f" f! u$ R$ K
//DIR dir;
! x# s. w/ g& M3 U FRESULT res; // FatFs function common result code, |6 H c; H+ U1 x \) j- q
" s f+ b6 [6 z1 U% ^" l# f
//检测磁盘是否插好: ~# V# X! ]! ~1 O! F4 b
//if(disk_detect_OK()==FALSE ) return ;
' g5 _( D T+ m) j+ D //printf("\r\n inaert_ok:>");; l# R N% q5 \- W( P; l
// Register a work area for logical drive 0! U x0 G: A8 X b
f_mount(0, &fs);5 A" I, T: Q; D( U1 N% t, Q* a
//f_opendir (&dir,path);- Y, M& f) V" V1 a: M% B; P7 O6 b
res=f_unlink(path);//删除一个文件5 m1 B5 g3 S& H
//die(res);
- x9 P9 {) n% ^, F+ C; U- W% @ f_mount(0, NULL);! a& u+ R& k" k- i7 r, G- O
return res;$ ~, Q5 v# p7 y5 n
}8 l7 _* n: f' l) W3 ]6 I
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
' p4 \" f" u1 y8 i) GFRESULT Test_f_readfile(const TCHAR* path,char *buff,DWORD ofs,UINT strl)//读文件的数据,如果没有此文件则返回错误;输入文件的路径名,内容缓存,读取开始偏移指针,读取的字节数
. M, t8 g" H3 n. ?{ //Test_f_readfile("/dir/r.txt",str,0,sizeof(strr));
# y( g9 X) y0 M- I) S2 b! z FATFS fs; // Work area (file system object) for logical drive% Z4 d, n1 S+ C) ]4 J5 ^: k. X
FIL file; // file objects3 P7 u2 p8 J; H( W5 c3 j: @
FRESULT res; // FatFs function common result code4 Z7 V3 [7 r. e: G/ |, \6 q
UINT br; // File R count 文件读回的字节计数
1 p' A f5 P" r7 p; V5 x$ m4 k //u16 i;
% k" k* O, A' a9 e. c+ P# Q% V //检测磁盘是否插好0 ^, o$ U6 a2 w
//if( disk_detect_OK()==FALSE ) return;
8 Z- N9 T5 Z+ ~& ]2 v# Z // Register a work area for logical drive 0
, A9 c5 H8 c; w4 j$ r9 p3 c) V //for(i=0;i<sizeof(buff);i++) buff[i]='\0';
" X0 k, n* u- s% w S f_mount(0, &fs);1 |8 z4 T* u! M
//Open source file
6 N# }2 `. R R1 l5 b/ e+ N/ _$ t res = f_open(&file, path, FA_OPEN_EXISTING | FA_READ);//打开存在的文件,如果没有则返回错误
; R. g* C' @% S2 y- a* J //die(res);, ~5 x; p( K6 W
res = f_lseek(&file,ofs); //指针移到文件ofs个字节处) |( Z' o" ~3 A0 j8 T/ O
//buffer空间设大一点,会提高读的速度。
) }- X, i9 t+ }" | //如果文件实际大小512byte,' g6 C2 T& T9 e3 H4 c! E4 Y8 l
//设为buffer[512]时,只需要循坏一次,如果设为buffer[1],需要循坏512次。
8 L' m5 o! B( y: o7 |) T0 C8 e5 ^9 [ //for (;;)
k: o6 b9 z" R* W2 ^ {$ f. d: e2 h( u$ C0 ~2 }7 D
//for(i=0;i<sizeof(buff);i++) buff[i]='\0';//清除缓存5 Z7 m* y# O% ]! B% v8 C; o( y
& t4 z- @7 J: y& w! |& W res = f_read(&file, buff, strl, &br);+ D2 t, o, l6 x9 ~
//if (res ||(br == 0)) break; // error or eof如果错误或者到文件末尾则退出
3 d' ?* p8 _* I2 b& w 2 s- `0 c$ o4 e' g% `3 n3 t% q1 _! J5 P3 \
//printf("%s",buff);
; I' O# k3 \" Z/ E/ A( M9 T } : L, S& N6 r% F$ L9 {/ U7 ~
// Close all files* `0 @3 y' y$ _
f_close(&file);
# L4 O* L* X; K# x9 P, h# ?" l // Unregister a work area before discard it: m8 c7 }- k" ?: ]! s( U
f_mount(0, NULL);- }2 s6 L; J. Q% Q& q
return res;
* h$ Z/ ~+ \% Y( c8 y) W. h: `}( A4 B" d7 t" ?' Z. Y
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////5 \+ c [1 d) |, f9 E o; W) L
FRESULT Test_f_writefile(const TCHAR* path,char *buff,DWORD ofs,UINT strl)//写数据到文件,如果没有此文件则创建文件;输入文件的路径名,内容缓存,写开始偏移指针,写的字节数9 W$ Y. ^0 j9 ~1 k( O2 i" M. W
{ //Test_f_writefile("/dir/r.txt",strw,0,strlen(strw));
' G3 Q( r7 L7 M6 g* {/ o+ j FATFS fs; // Work area (file system object) for logical drive% l8 D: h7 F9 G1 ?
FRESULT res; // FatFs function common result code
9 w/ _. _$ m5 v6 k8 F/ v FIL file;9 c: j; ~2 u$ f* F! j
UINT bw; //文件写入的字节计数
7 L/ U9 e" i6 w: c+ N1 h //检测磁盘是否插好
1 p8 \) i+ y2 P0 n' C7 \. s //if( disk_detect_OK()==FALSE ) return;
) |! Y2 R3 E9 E; m // Register a work area for logical drive 08 F, x/ @# \+ Q6 T, F8 X) r; K6 [
f_mount(0, &fs);2 C% V4 P" S K& o$ ^ ?
res = f_open(&file, path, FA_OPEN_ALWAYS | FA_WRITE); //可写方式打开 没有文件则创建
0 m7 r m: q0 J5 I0 p# F //die(res);+ K" I3 I% X$ u
res = f_lseek(&file, ofs); //指针移到文件ofs处;输入file.fsize指针移到文件最后 9 s1 l6 E7 D$ I2 d1 a
//die(res);
?0 O" R1 l, F; @/ m! k4 I res = f_write(&file, buff, strl, &bw); //每次需要写入的数据字节数;如果btr为strlen(buff)则写入所有的字符
1 \+ s. K4 G4 G //die(res);
! M8 G2 j6 t- `2 u7 |0 c //res = f_lseek(&file, Make_file.fsize); //指针移到文件最后,一边再一次的写入 , V, j- i/ @% g' j' p& h
f_close(&file);//关闭文件
# P" w1 b# o! a0 J+ R( {! B/ M // Unregister a work area before discard it
0 Q! k7 T B8 U5 M' R* L- d! g f_mount(0, NULL);+ t& d8 I3 m7 v
return res;! w9 e2 h! D" u9 F. G: c
}$ O1 }8 r5 l p% f; I
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// y! K# F' R. W/ @% b% L0 ?& d2 t: h
FRESULT Test_f_getfreem(DWORD *freem)//获取卡的剩余容量单位为M
7 x) g: f0 S/ }* b{! z* v: K& N: k) _
FATFS fs;
2 o* M8 T/ V2 B, j ` FATFS *pfs;' m: H2 N% r5 d4 b# d+ [
FRESULT res; // FatFs function common result code; g8 O0 L5 o' \7 _2 r2 M8 k2 G
//检测磁盘是否插好
: ?$ g; n8 D9 K- c! n, I //if( disk_detect_OK()==FALSE ) return;9 ~5 e7 x$ P6 y9 g, @+ f% g; E5 ^. m
// Register a work area for logical drive 0
, p" x+ L, N6 Q4 l1 T9 b" J pfs=&fs;//指向
$ d3 ~ R3 _3 q) P f_mount(0, &fs);//安装FATFS,就是给FATFS分配空间( ]3 j: v: c+ U# [8 q
// Get free clusters* }* _( j, e o/ C
res = f_getfree("/",freem,&pfs);//必须是根目录,默认磁盘0;"/"或者"0:/"
6 ?6 o% @0 |" I4 r: z$ [1 F* l //die(res);+ l$ C) ]0 e1 `
if ( res==FR_OK ) / A8 ~3 g) K$ r9 d6 M
{
8 ]' j% G0 G5 s' A // Get free space. |! A$ w ]1 Z% d
//printf("\r\n%d MB total disk space.\r\n%d MB available on the disk.\r\n",
* U v; E$ W4 S4 ^0 r7 f5 C7 m* ?, W //(DWORD)(pfs->n_fatent - 2) * (pfs->csize) /2/1024,//总的磁盘空间M =(总簇数-2)*每簇的扇区数/2/1024=可用簇数*每簇的扇区数/2/1024
, I# a- b$ V5 K" L- `& l //(*freem)*(pfs->csize)/2/1024);//空闲的磁盘空间M=剩余簇数*每簇的扇区数/2/1024# y$ b8 x! `' M+ U, b d3 g3 c" ^5 B& j
*freem=((*freem)*pfs->csize)/2/1024;
+ |( C& V% q5 ?) ?, `- R* X }* P2 ]& r2 e5 s+ Z0 c+ q$ v, R
//else die(res);//测试函数执行结果分析! o3 v5 s) _8 x7 l# M
// Unregister a work area before discard it. N+ K8 y( j/ c9 {' U
f_mount(0, NULL);//卸载FATFS,就是释放FATFS结构体所占空间: }7 i; [. H- i5 [
return res;7 |) e. |! G J) n$ z' }
}
) x( \7 A2 e5 w0 \+ @; s O, ]
% U' k3 z# i/ I+ l( }5 d$ c- F% P. P1 @5 E& R+ d3 D4 E3 J. Z
# s4 ]) ]& H/ D$ @( y6 `/ Feb 26,'06 R0.00 Prototype.( h- L8 v9 Q( I5 u4 e3 _ f' x+ z i
/9 a, X/ n' ~+ M% Y( j- A
/ Apr 29,'06 R0.01 First stable version.. @; m9 @' x- d) s; M o7 [
/& p9 `+ ^$ q; L; U( {9 F
/ Jun 01,'06 R0.02 Added FAT12 support.
6 \8 A# M; ^. i/ k8 ]/ Removed unbuffered mode.7 ]" c0 ~0 K4 P" Y$ Q
/ Fixed a problem on small (<32M) partition.
2 U$ _# Q* e, G4 \- G+ _/ Jun 10,'06 R0.02a Added a configuration option (_FS_MINIMUM).
4 Q% |) x; H" w" x1 s0 o8 E* }/
4 |+ D# [; {5 {/ Sep 22,'06 R0.03 Added f_rename()./ p+ M! F, m4 q" |* n1 E" r# x
/ Changed option _FS_MINIMUM to _FS_MINIMIZE.+ L8 ]9 v( G" o. n
/ Dec 11,'06 R0.03a Improved cluster scan algorithm to write files fast., a, d. O0 Q/ m$ G
/ Fixed f_mkdir() creates incorrect directory on FAT32.
1 ?' y3 ]$ l4 i& F: }/
% v# H. e7 y) m! |3 E; D/ Feb 04,'07 R0.04 Supported multiple drive system.
$ W- t6 S: {$ m/ T/ Changed some interfaces for multiple drive system.
2 W0 _$ k u0 v; v5 Y/ Changed f_mountdrv() to f_mount().
2 w9 Q, d9 ?5 ^& I% J! k/ Added f_mkfs().
& w5 S( o1 b: L, M: |7 y6 j/ Apr 01,'07 R0.04a Supported multiple partitions on a physical drive.& ~* z: \+ N: L8 F: A4 g% C
/ Added a capability of extending file size to f_lseek().
$ [, p3 W- V) U) v6 Z/ Added minimization level 3.
* A L" W5 S7 |3 l1 X; X3 m/ Fixed an endian sensitive code in f_mkfs()./ ?* U3 E% H5 X4 ^
/ May 05,'07 R0.04b Added a configuration option _USE_NTFLAG.
% N3 o' H2 ^5 c5 s R# o/ Added FSInfo support.
# }4 M" z. _( H/ u. Z$ c0 c+ A/ Fixed DBCS name can result FR_INVALID_NAME.
' I& h* ^# Y% x: H# ~; v3 ?" ]/ Fixed short seek (<= csize) collapses the file object.* ]" U7 e! m9 O7 O" Y, l
/
! B9 ~* u" B- b" B/ Aug 25,'07 R0.05 Changed arguments of f_read(), f_write() and f_mkfs().7 ?; C% y% p+ Z3 I
/ Fixed f_mkfs() on FAT32 creates incorrect FSInfo.6 K& P; i( Y3 [8 d
/ Fixed f_mkdir() on FAT32 creates incorrect directory.& Y8 ~/ s) z/ V( Y
/ Feb 03,'08 R0.05a Added f_truncate() and f_utime().' r$ U3 X6 L: [& g' g. w# y/ d" y
/ Fixed off by one error at FAT sub-type determination.1 O4 }% f- q# K2 {7 O6 V
/ Fixed btr in f_read() can be mistruncated.
1 p/ W/ L, {* u \" f/ Fixed cached sector is not flushed when create and close without write.
. N3 k6 }: b# R/
$ S% v, k n( G( P/ Apr 01,'08 R0.06 Added fputc(), fputs(), fprintf() and fgets().
. v; y( x! I- @$ \$ P7 j/ Improved performance of f_lseek() on moving to the same or following cluster., v* b9 s, f# P* \. g
/2 o( o' V3 I$ b; q# ?& L/ N
/ Apr 01,'09 R0.07 Merged Tiny-FatFs as a configuration option. (_FS_TINY), v0 m* g( t q' d0 M
/ Added long file name feature.
! Y9 }& k) }, Z9 N8 H/ Added multiple code page feature.
& m+ l0 I5 m- [& g3 v6 Q/ Added re-entrancy for multitask operation.
3 r5 r8 z/ S1 R3 Q/ Added auto cluster size selection to f_mkfs().* R1 }4 I0 r* P' Z4 }: E
/ Added rewind option to f_readdir().
& l2 }' p& W: }, @/ Changed result code of critical errors.
) z# e2 w& l" K7 {* J+ O+ P: K/ Renamed string functions to avoid name collision.& x+ A% m# G3 {; x0 k( T& H
/ Apr 14,'09 R0.07a Separated out OS dependent code on reentrant cfg.
" C. U! }7 I/ m. y7 W0 Q3 ]/ Added multiple sector size feature.* q$ ?3 V) `* I) r" f1 M
/ Jun 21,'09 R0.07c Fixed f_unlink() can return FR_OK on error.
5 v* `2 ]* B7 r, J9 i/ Fixed wrong cache control in f_lseek().
+ C& a V+ _+ P. Q. z1 z/ Added relative path feature.
: I( t! M' O/ _- z' _$ S. {/ Added f_chdir() and f_chdrive().+ y/ |# o5 i/ ?
/ Added proper case conversion to extended char.* K5 m; h8 j- x1 D
/ Nov 03,'09 R0.07e Separated out configuration options from ff.h to ffconf.h.5 }2 f/ Y2 X( S# N/ X
/ Fixed f_unlink() fails to remove a sub-dir on _FS_RPATH.
7 \, V* Q9 C A- K* u0 K" h8 J/ Fixed name matching error on the 13 char boundary.. t! u' S) C# q( o1 n
/ Added a configuration option, _LFN_UNICODE.
p# I6 m, T7 p7 _+ P/ Changed f_readdir() to return the SFN with always upper case on non-LFN cfg.
8 s+ K: W Y; |$ X/
* F( m c9 l. T8 [" ?$ k$ ~1 i/ May 15,'10 R0.08 Added a memory configuration option. (_USE_LFN = 3)
5 n0 i. E. I% k$ b8 r2 P; I# \$ D( }8 ^/ Added file lock feature. (_FS_SHARE)! j9 G5 Q/ N; J
/ Added fast seek feature. (_USE_FASTSEEK)
( M" K2 U7 G# s2 j9 y/ t5 e/ Changed some types on the API, XCHAR->TCHAR.
$ B2 P k. A! z- y1 m9 \8 I r3 N5 R/ Changed fname member in the FILINFO structure on Unicode cfg.
- b: k- {% j: W+ W: _$ S) p/ String functions support UTF-8 encoding files on Unicode cfg.
: _2 x% ]6 U1 T! \/ Aug 16,'10 R0.08a Added f_getcwd(). (_FS_RPATH = 2)' A' I6 ~ J/ r% G+ ^1 L" \2 g% a
/ Added sector erase feature. (_USE_ERASE)
. O+ I4 ~* D! G- P( V9 w/ Moved file lock semaphore table from fs object to the bss.- v& U' V6 d0 h. c6 a
/ Fixed a wrong directory entry is created on non-LFN cfg when the given name contains ';'.
: ^, w8 }8 w8 Y- k/ Fixed f_mkfs() creates wrong FAT32 volume.
+ i& ?9 u/ P! m. }' A4 l/ X/ Jan 15,'11 R0.08b Fast seek feature is also applied to f_read() and f_write().
- g7 p5 i7 E: r; r/ f% L/ f_lseek() reports required table size on creating CLMP.
# z4 X2 \% ?/ S8 N( t7 @/ Extended format syntax of f_printf function.0 H' |$ h) I8 M' f: m& J8 V
/ Ignores duplicated directory separators in given path names.
' S. S: R- O7 D" r' [& O6 ~/( l, M+ z+ ]2 k: f; @- i
/ Sep 06,'11 R0.09 f_mkfs() supports multiple partition to finish the multiple partition feature.
, r" ]1 }3 @; e+ o/ N y y/ Added f_fdisk(). (_MULTI_PARTITION = 2)
|0 {4 P$ U) J8 n9 @/---------------------------------------------------------------------------*/
8 [/ Y' u2 R9 ?- n/ {: |/ w( I0 p- J& Z! U0 Z- T# c6 \
|
|