您好,欢迎访问三七文档
当前位置:首页 > 行业资料 > 国内外标准规范 > FatFs的配置文件是fatfs
FatFs的配置文件是fatfs_config.hSD的优势之一是它的便携性,它可以自由插拔,可以在嵌入式设备和PC机之间交换数据。如果使用FAT(FileAllocationTable)文件系统,它便可以方便在安装windows的PC和嵌入式设备之间交换数据。一个完整的FAT文件系统代码量非常庞大,不适合资源较少的嵌入式系统,于是就需要一个微型的FAT文件系统,FatFs就是基于这样的目的而开发的。FatFS是一个专为小型嵌入式系统设计的通用FAT文件系统模块。FatFs具有较高的可配置性,最小配置仅使用1K的RAM空间,非常适用于嵌入式系统。FatFs的编写遵循ANSIC,并且完全与磁盘I/O层分开。因此,它独立(不依赖)于硬件架构。它可以被嵌入到低成本的微控制器中,如AVR,8051,PIC,ARM,Z80,68K等等,而不需要做任何修改。特点Windows兼容的FAT文件系统不依赖于平台,易于移植代码和工作区占用空间非常小多种配置选项:多卷(物理驱动器和分区)多ANSI/OEM代码页,包括DBCS在ANSI/OEM或Unicode中长文件名的支持RTOS的支持多扇区大小的支持只读,最少API,I/O缓冲区等等FatFs的源代码只有几个文件:diskio.c,ff.c,ff_util.c,tff.c及头文件。diskio.c是磁盘操作的代码文件(这个文件是移植时要实现的),ff.c是一般FatFs的代码文件,tff.c是微型FatFs的代码文件,ff_util.c是几个辅助函数。integer.h是内部基本类型的定义,ff.h是一般FatFs包含的头文件,tff.h是微型FatFs包含的头文件。[cpp]viewplaincopy在CODE上查看代码片派生到我的代码片#if_FATFS_TINY!=1#includefatfs/src/ff.h#else#includefatfs/src/tff.h#endif#includefatfs/src/ff_util.h微型FatFs配置最小时仅占用内存1KB,但它是一个只读的FAT系统。FatFs的配置文件是fatfs_config.h:[cpp]viewplaincopy在CODE上查看代码片派生到我的代码片//------------------------------------------------------------------------------//GeneralDefinitions(previouslyinff.h)//------------------------------------------------------------------------------#define_FATFS_TINY0/*When_FATFS_TINYissetto1,fatfsiscompiledinTinymode/Else,itiscompiledinnormalmode/TinyFatFsfeature:Verylowmemoryconsumption,suitableforsmallmemory/system.(1KBRAM):Supportsonlysingledrive,nodiskformat,/onlyreadfunctions,nowritefunctions*///------------------------------------------------------------------------------//DefinitionsfornormalFATFS(previouslyinff.h)//------------------------------------------------------------------------------#if_FATFS_TINY==0#define_MCU_ENDIAN2/*The_MCU_ENDIANdefineswhichaccessmethodisusedtotheFATstructure./1:Enablewordaccess./2:Disablewordaccessandusebyte-by-byteaccessinstead./WhenthearchitecturalbyteorderoftheMCUisbig-endianand/oraddress/miss-alignedaccessresultsincorrectbehavior,the_MCU_ENDIANmustbesetto2./Ifitisnotthecase,itcanalsobesetto1forgoodcodeefficiency.*/#define_FS_READONLY0/*Setting_FS_READONLYto1definesreadonlyconfiguration.Thisremoves/writingfunctions,f_write,f_sync,f_unlink,f_mkdir,f_chmod,f_rename,/f_truncateanduselessf_getfree.*/#define_FS_MINIMIZE0/*The_FS_MINIMIZEoptiondefinesminimizationleveltoremovesomefunctions./0:Fullfunction./1:f_stat,f_getfree,f_unlink,f_mkdir,f_chmod,f_truncateandf_renameareremoved./2:f_opendirandf_readdirareremovedinadditiontolevel1./3:f_lseekisremovedinadditiontolevel2.*/#define_USE_STRFUNC0/*Toenablestringfunctions,set_USE_STRFUNCto1or2.*/#define_USE_FSINFO1/*ToenableFSInfosupportonFAT32volume,set_USE_FSINFOto1.*/#define_USE_SJIS1/*When_USE_SJISissetto1,Shift-JIScodetransparencyisenabled,otherwise/onlyUS-ASCII(7bit)codecanbeacceptedasfile/directoryname.*/#define_USE_NTFLAG1/*When_USE_NTFLAGissetto1,upper/lowercaseofthefilenameispreserved./Notethatthefilesarealwaysaccessedincaseinsensitive.*/#define_USE_MKFS1/*When_USE_MKFSissetto1and_FS_READONLYissetto0,f_mkfsfunctionis/enabled.*/#define_DRIVES2/*Numberoflogicaldrivestobeused.Thisaffectsthesizeofinternaltable.*/#define_MULTI_PARTITION0/*When_MULTI_PARTITIONissetto0,eachlogicaldriveisboundtosame/physicaldrivenumberandcanmountonly1stprimalypartition.Whenitis/setto1,eachlogicaldrivecanmountapartitionlistedinDrives[].*///------------------------------------------------------------------------------//DefinitionsfornormalFATFSTINY(previouslyintff.h)//------------------------------------------------------------------------------#else#define_MCU_ENDIAN2/*The_MCU_ENDIANdefineswhichaccessmethodisusedtotheFATstructure./1:Enablewordaccess./2:Disablewordaccessandusebyte-by-byteaccessinstead./WhenthearchitecturalbyteorderoftheMCUisbig-endianand/oraddress/miss-alignedaccessresultsincorrectbehavior,the_MCU_ENDIANmustbesetto2./Ifitisnotthecase,itcanalsobesetto1forgoodcodeefficiency.*/#define_FS_READONLY1/*Setting_FS_READONLYto1definesreadonlyconfiguration.Thisremoves/writingfunctions,f_write,f_sync,f_unlink,f_mkdir,f_chmod,f_rename,/f_truncate,f_getfreeandinternalwritingcodes.*/#define_FS_MINIMIZE0/*The_FS_MINIMIZEoptiondefinesminimizationleveltoremovesomefunctions./0:Fullfunction./1:f_stat,f_getfree,f_unlink,f_mkdir,f_chmod,f_truncateandf_renameareremoved./2:f_opendirandf_readdirareremovedinadditiontolevel1./3:f_lseekisremovedinadditiontolevel2.*/#define_USE_STRFUNC0/*Toenablestringfunctions,set_USE_STRFUNCto1or2.*/#define_USE_FSINFO1/*ToenableFSInfosupportonFAT32volume,set_USE_FSINFOto1.*/#define_USE_SJIS1/*When_USE_SJISissetto1,Shift-JIScodetransparencyisenabled,otherwise/onlyUS-ASCII(7bit)codecanbeacceptedasfile/directoryname.*/#define_USE_NTFLAG1/*When_USE_NTFLAGissetto1,upper/lowercaseofthefilenameispreserved./Notethatthefilesarealwaysaccessedincaseinsensitive.*/#define_USE_FORWARD0/*Toenablef_forwardfunction,set_USE_FORWARDto1.*/#define_FAT321/*ToenableFAT32supportinadditionofFAT12/16,set_FAT32to1.*/#endif//------------------------------------------------------------------------------//Otherdefinitions//-----------------------------------------
本文标题:FatFs的配置文件是fatfs
链接地址:https://www.777doc.com/doc-2871460 .html