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