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