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