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