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