📄 tff_8h-source.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>Sample MSP430-4619LCD Project: tff.h Source File</title><link href="doxygen.css" rel="stylesheet" type="text/css"><link href="tabs.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.5.1 --><div class="tabs"> <ul> <li><a href="main.html"><span>Main Page</span></a></li> <li><a href="annotated.html"><span>Data Structures</span></a></li> <li id="current"><a href="files.html"><span>Files</span></a></li> </ul></div><div class="tabs"> <ul> <li><a href="files.html"><span>File List</span></a></li> <li><a href="globals.html"><span>Globals</span></a></li> </ul></div><h1>tff.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*--------------------------------------------------------------------------/</span><a name="l00002"></a>00002 <span class="comment">/ Tiny-FatFs - FAT file system module include file R0.04b (C)ChaN, 2007</span><a name="l00003"></a>00003 <span class="comment">/---------------------------------------------------------------------------/</span><a name="l00004"></a>00004 <span class="comment">/ FatFs module is an experimenal project to implement FAT file system to</span><a name="l00005"></a>00005 <span class="comment">/ cheap microcontrollers. This is a free software and is opened for education,</span><a name="l00006"></a>00006 <span class="comment">/ research and development under license policy of following trems.</span><a name="l00007"></a>00007 <span class="comment">/</span><a name="l00008"></a>00008 <span class="comment">/ Copyright (C) 2007, ChaN, all right reserved.</span><a name="l00009"></a>00009 <span class="comment">/</span><a name="l00010"></a>00010 <span class="comment">/ * The FatFs module is a free software and there is no warranty.</span><a name="l00011"></a>00011 <span class="comment">/ * You can use, modify and/or redistribute it for personal, non-profit or</span><a name="l00012"></a>00012 <span class="comment">/ profit use without any restriction under your responsibility.</span><a name="l00013"></a>00013 <span class="comment">/ * Redistributions of source code must retain the above copyright notice.</span><a name="l00014"></a>00014 <span class="comment">/</span><a name="l00015"></a>00015 <span class="comment">/---------------------------------------------------------------------------*/</span><a name="l00016"></a>00016 <a name="l00017"></a>00017 <span class="preprocessor">#ifndef _FATFS</span><a name="l00018"></a>00018 <span class="preprocessor"></span><a name="l00019"></a>00019 <span class="preprocessor">#define _MCU_ENDIAN 2</span><a name="l00020"></a>00020 <span class="preprocessor"></span><span class="comment">/* The _MCU_ENDIAN defines which access method is used to the FAT structure.</span><a name="l00021"></a>00021 <span class="comment">/ 1: Enable word access.</span><a name="l00022"></a>00022 <span class="comment">/ 2: Disable word access and use byte-by-byte access instead.</span><a name="l00023"></a>00023 <span class="comment">/ When the architectural byte order of the MCU is big-endian and/or address</span><a name="l00024"></a>00024 <span class="comment">/ miss-aligned access is prohibited, the _MCU_ENDIAN must be set to 2.</span><a name="l00025"></a>00025 <span class="comment">/ If it is not the case, it can be set to 1 for good code efficiency. */</span><a name="l00026"></a>00026 <a name="l00027"></a>00027 <span class="preprocessor">#define _FS_READONLY 0</span><a name="l00028"></a>00028 <span class="preprocessor"></span><span class="comment">/* Setting _FS_READONLY to 1 defines read only configuration. This removes</span><a name="l00029"></a>00029 <span class="comment">/ writing functions, f_write, f_sync, f_unlink, f_mkdir, f_chmod, f_rename</span><a name="l00030"></a>00030 <span class="comment">/ and useless f_getfree. */</span><a name="l00031"></a>00031 <a name="l00032"></a>00032 <span class="preprocessor">#define _FS_MINIMIZE 0</span><a name="l00033"></a>00033 <span class="preprocessor"></span><span class="comment">/* The _FS_MINIMIZE option defines minimization level to remove some functions.</span><a name="l00034"></a>00034 <span class="comment">/ 0: Full function.</span><a name="l00035"></a>00035 <span class="comment">/ 1: f_stat, f_getfree, f_unlink, f_mkdir, f_chmod and f_rename are removed.</span><a name="l00036"></a>00036 <span class="comment">/ 2: f_opendir and f_readdir are removed in addition to level 1.</span><a name="l00037"></a>00037 <span class="comment">/ 3: f_lseek is removed in addition to level 2. */</span><a name="l00038"></a>00038 <a name="l00039"></a>00039 <span class="preprocessor">#define _FAT32 1</span><a name="l00040"></a>00040 <span class="preprocessor"></span><span class="comment">/* To enable FAT32 support in addition of FAT12/16, set _FAT32 to 1. */</span><a name="l00041"></a>00041 <a name="l00042"></a>00042 <span class="preprocessor">#define _USE_FSINFO 0</span><a name="l00043"></a>00043 <span class="preprocessor"></span><span class="comment">/* To enable FSInfo support on FAT32 volume, set _USE_FSINFO to 1. */</span><a name="l00044"></a>00044 <a name="l00045"></a>00045 <span class="preprocessor">#define _USE_SJIS 1</span><a name="l00046"></a>00046 <span class="preprocessor"></span><span class="comment">/* When _USE_SJIS is set to 1, Shift-JIS code transparency is enabled, otherwise</span><a name="l00047"></a>00047 <span class="comment">/ only US-ASCII(7bit) code can be accepted as file/directory name. */</span><a name="l00048"></a>00048 <a name="l00049"></a>00049 <span class="preprocessor">#define _USE_NTFLAG 1</span><a name="l00050"></a>00050 <span class="preprocessor"></span><span class="comment">/* When _USE_NTFLAG is set to 1, upper/lower case of the file name is preserved.</span><a name="l00051"></a>00051 <span class="comment">/ Note that the files are always accessed in case insensitive. */</span><a name="l00052"></a>00052 <a name="l00053"></a>00053 <a name="l00054"></a>00054 <span class="preprocessor">#include "integer.h"</span><a name="l00055"></a>00055 <a name="l00056"></a>00056 <a name="l00057"></a>00057 <span class="comment">/* Type definition for cluster number */</span><a name="l00058"></a>00058 <span class="preprocessor">#if _FAT32</span><a name="l00059"></a>00059 <span class="preprocessor"></span><span class="keyword">typedef</span> DWORD CLUST;<a name="l00060"></a>00060 <span class="preprocessor">#else</span><a name="l00061"></a>00061 <span class="preprocessor"></span><span class="keyword">typedef</span> WORD CLUST;<a name="l00062"></a>00062 <span class="preprocessor">#undef _USE_FSINFO</span><a name="l00063"></a>00063 <span class="preprocessor"></span><span class="preprocessor">#define _USE_FSINFO 0</span><a name="l00064"></a>00064 <span class="preprocessor"></span><span class="preprocessor">#endif</span><a name="l00065"></a>00065 <span class="preprocessor"></span><a name="l00066"></a>00066 <a name="l00067"></a>00067 <span class="comment">/* File system object structure */</span><a name="l00068"></a><a class="code" href="struct__FATFS.html">00068</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct__FATFS.html">_FATFS</a> {<a name="l00069"></a><a class="code" href="struct__FATFS.html#cbad613b810b3559a1549bfbe39c0600">00069</a> WORD <a class="code" href="struct__FATFS.html#cbad613b810b3559a1549bfbe39c0600">id</a>; <span class="comment">/* File system mount ID */</span><a name="l00070"></a><a class="code" href="struct__FATFS.html#c33c59bc32161ba408c0b7d4227a9d9e">00070</a> WORD <a class="code" href="struct__FATFS.html#c33c59bc32161ba408c0b7d4227a9d9e">n_rootdir</a>; <span class="comment">/* Number of root directory entries */</span><a name="l00071"></a><a class="code" href="struct__FATFS.html#4d7990897697ab6b380e1036672d40a2">00071</a> DWORD <a class="code" href="struct__FATFS.html#4d7990897697ab6b380e1036672d40a2">winsect</a>; <span class="comment">/* Current sector appearing in the win[] */</span><a name="l00072"></a><a class="code" href="struct__FATFS.html#08708ab393918e5bfdbf2be9492a6094">00072</a> DWORD <a class="code" href="struct__FATFS.html#08708ab393918e5bfdbf2be9492a6094">fatbase</a>; <span class="comment">/* FAT start sector */</span><a name="l00073"></a><a class="code" href="struct__FATFS.html#3c1a4db83aea0aec5eed50b12c72da55">00073</a> DWORD <a class="code" href="struct__FATFS.html#3c1a4db83aea0aec5eed50b12c72da55">dirbase</a>; <span class="comment">/* Root directory start sector */</span><a name="l00074"></a><a class="code" href="struct__FATFS.html#f5866e883dc225244f15abd7894fafc8">00074</a> DWORD <a class="code" href="struct__FATFS.html#f5866e883dc225244f15abd7894fafc8">database</a>; <span class="comment">/* Data start sector */</span><a name="l00075"></a><a class="code" href="struct__FATFS.html#118b4c13971f9e8964568a65d5e3f2ed">00075</a> CLUST <a class="code" href="struct__FATFS.html#118b4c13971f9e8964568a65d5e3f2ed">sects_fat</a>; <span class="comment">/* Sectors per fat */</span><a name="l00076"></a><a class="code" href="struct__FATFS.html#7f5a5466252185cec7c0903feaf6d702">00076</a> CLUST <a class="code" href="struct__FATFS.html#7f5a5466252185cec7c0903feaf6d702">max_clust</a>; <span class="comment">/* Maximum cluster# + 1 */</span><a name="l00077"></a>00077 <span class="preprocessor">#if !_FS_READONLY</span><a name="l00078"></a><a class="code" href="struct__FATFS.html#fefa77a3df67f4de4d858293935781c0">00078</a> <span class="preprocessor"></span> CLUST <a class="code" href="struct__FATFS.html#fefa77a3df67f4de4d858293935781c0">last_clust</a>; <span class="comment">/* Last allocated cluster */</span><a name="l00079"></a><a class="code" href="struct__FATFS.html#a8360b3d9614f1bdf103e321239d71ff">00079</a> CLUST <a class="code" href="struct__FATFS.html#a8360b3d9614f1bdf103e321239d71ff">free_clust</a>; <span class="comment">/* Number of free clusters */</span><a name="l00080"></a>00080 <span class="preprocessor">#if _USE_FSINFO</span><a name="l00081"></a>00081 <span class="preprocessor"></span> DWORD fsi_sector; <span class="comment">/* fsinfo sector */</span><a name="l00082"></a>00082 BYTE fsi_flag; <span class="comment">/* fsinfo dirty flag (1:must be written back) */</span><a name="l00083"></a>00083 BYTE pad1;<a name="l00084"></a>00084 <span class="preprocessor">#endif</span><a name="l00085"></a>00085 <span class="preprocessor"></span><span class="preprocessor">#endif</span><a name="l00086"></a><a class="code" href="struct__FATFS.html#91bea3661c2ffe4f65143c163493b995">00086</a> <span class="preprocessor"></span> BYTE <a class="code" href="struct__FATFS.html#91bea3661c2ffe4f65143c163493b995">fs_type</a>; <span class="comment">/* FAT sub type */</span><a name="l00087"></a><a class="code" href="struct__FATFS.html#cf77b8f2c894bc68302efe617ed9e09e">00087</a> BYTE <a class="code" href="struct__FATFS.html#cf77b8f2c894bc68302efe617ed9e09e">sects_clust</a>; <span class="comment">/* Sectors per cluster */</span>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -