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