?? fs_ffree.c
字號:
/*----------------------------------------------------------------------------
* R T L - F l a s h F i l e S y s t e m
*----------------------------------------------------------------------------
* Name: FS_FFREE.C
* Purpose: Get File System Free Space Function
* Rev.: V3.22
*----------------------------------------------------------------------------
* This code is part of the RealView Run-Time Library.
* Copyright (c) 2004-2008 KEIL - An ARM Company. All rights reserved.
*---------------------------------------------------------------------------*/
#include "File_Config.h"
/*--------------------------- ffree -----------------------------------------*/
U32 ffree (const char *drive) {
/* Find a free space in the Flash File System. */
IOB *fcb;
int handle;
U32 bl, free = 0;
/* Find an unused _iob structure. */
if ((handle = fs_find_iob ()) == EOF) {
return (0);
}
fcb = &_iob[handle];
/* Get the drive index. */
fcb->drive = fs_get_drive (drive);
if (fcb->drive == DRV_NONE && *drive == 0) {
/* Empty string provided for a drive name. */
fcb->drive = _DEF_DRIVE;
}
if (fcb->drive == DRV_NONE) {
/* Invalid drive letter specified. */
return (0);
}
if (fcb->drive == DRV_MCARD) {
/* Calculate Free Memory for a Flash Card. */
free = fat_free ();
return (free);
}
/* Set drive parameters. */
if (fs_set_params (fcb) == __FALSE) {
return (0);
}
for (bl = 0; bl < fcb->NumSect; bl++) {
/* Search all File Blocks for free space. */
free += fs_get_freeMem (bl, fcb);
}
return (free);
}
/*----------------------------------------------------------------------------
* end of file
*---------------------------------------------------------------------------*/
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -