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