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