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