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