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