tff_8h-source.html

来自「MSP acquires data and sends through USB 」· HTML 代码 · 共 314 行 · 第 1/3 页

HTML
314
字号
<a name="l00088"></a><a class="code" href="struct__FATFS.html#29d47bd0e83fe5eec8ed9b34cf814d53">00088</a>         BYTE    <a class="code" href="struct__FATFS.html#29d47bd0e83fe5eec8ed9b34cf814d53">n_fats</a>;                 <span class="comment">/* Number of FAT copies */</span><a name="l00089"></a><a class="code" href="struct__FATFS.html#14c3cb7044924714bf3c7cc19b7da45e">00089</a>         BYTE    <a class="code" href="struct__FATFS.html#14c3cb7044924714bf3c7cc19b7da45e">winflag</a>;                <span class="comment">/* win[] dirty flag (1:must be written back) */</span><a name="l00090"></a><a class="code" href="struct__FATFS.html#32c85fa1d26f37661c21f5a1afaa2c08">00090</a>         BYTE    <a class="code" href="struct__FATFS.html#32c85fa1d26f37661c21f5a1afaa2c08">win</a>[512];               <span class="comment">/* Disk access window for Directory/FAT/File */</span><a name="l00091"></a>00091 } <a class="code" href="struct__FATFS.html">FATFS</a>;<a name="l00092"></a>00092 <a name="l00093"></a>00093 <a name="l00094"></a>00094 <span class="comment">/* Directory object structure */</span><a name="l00095"></a><a class="code" href="struct__DIR.html">00095</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct__DIR.html">_DIR</a> {<a name="l00096"></a><a class="code" href="struct__DIR.html#3138b51670ebe8fc2638e79ceaae3832">00096</a>         WORD    <a class="code" href="struct__DIR.html#3138b51670ebe8fc2638e79ceaae3832">id</a>;                     <span class="comment">/* Owner file system mount ID */</span><a name="l00097"></a><a class="code" href="struct__DIR.html#036a031851bde1b63d85c59293412a8d">00097</a>         WORD    <a class="code" href="struct__DIR.html#036a031851bde1b63d85c59293412a8d">index</a>;          <span class="comment">/* Current index */</span><a name="l00098"></a><a class="code" href="struct__DIR.html#b77148ebe964e29c524ffc843d33c30b">00098</a>         <a class="code" href="struct__FATFS.html">FATFS</a>*  <a class="code" href="struct__DIR.html#b77148ebe964e29c524ffc843d33c30b">fs</a>;                     <span class="comment">/* Pointer to the owner file system object */</span><a name="l00099"></a><a class="code" href="struct__DIR.html#762e543e9001d96ae71c1a24f52a9759">00099</a>         CLUST   <a class="code" href="struct__DIR.html#762e543e9001d96ae71c1a24f52a9759">sclust</a>;         <span class="comment">/* Start cluster */</span><a name="l00100"></a><a class="code" href="struct__DIR.html#36b08a0927f70fb693aac83949ee19b8">00100</a>         CLUST   <a class="code" href="struct__DIR.html#36b08a0927f70fb693aac83949ee19b8">clust</a>;          <span class="comment">/* Current cluster */</span><a name="l00101"></a><a class="code" href="struct__DIR.html#edba9551167ea52746b5f2c57ddce945">00101</a>         DWORD   <a class="code" href="struct__DIR.html#edba9551167ea52746b5f2c57ddce945">sect</a>;           <span class="comment">/* Current sector */</span><a name="l00102"></a>00102 } <a class="code" href="struct__DIR.html">DIR</a>;<a name="l00103"></a>00103 <a name="l00104"></a>00104 <a name="l00105"></a>00105 <span class="comment">/* File object structure */</span><a name="l00106"></a><a class="code" href="struct__FIL.html">00106</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct__FIL.html">_FIL</a> {<a name="l00107"></a><a class="code" href="struct__FIL.html#daa111238187b384d805b1b2d179cfbb">00107</a>         WORD    <a class="code" href="struct__FIL.html#daa111238187b384d805b1b2d179cfbb">id</a>;                             <span class="comment">/* Owner file system mount ID */</span><a name="l00108"></a><a class="code" href="struct__FIL.html#5dddbd79c839553fe56a99327ba1d3bb">00108</a>         BYTE    <a class="code" href="struct__FIL.html#5dddbd79c839553fe56a99327ba1d3bb">flag</a>;                   <span class="comment">/* File status flags */</span><a name="l00109"></a><a class="code" href="struct__FIL.html#27564bfac2387ca6e434910b25e324c1">00109</a>         BYTE    <a class="code" href="struct__FIL.html#27564bfac2387ca6e434910b25e324c1">sect_clust</a>;             <span class="comment">/* Left sectors in cluster */</span><a name="l00110"></a><a class="code" href="struct__FIL.html#87a6b42f27a8e1e7490ed07a2208427a">00110</a>         <a class="code" href="struct__FATFS.html">FATFS</a>*  <a class="code" href="struct__FIL.html#87a6b42f27a8e1e7490ed07a2208427a">fs</a>;                             <span class="comment">/* Pointer to owner file system */</span><a name="l00111"></a><a class="code" href="struct__FIL.html#4e9ac52e507e985ce4b3e54c8012b6b6">00111</a>         DWORD   <a class="code" href="struct__FIL.html#4e9ac52e507e985ce4b3e54c8012b6b6">fptr</a>;                   <span class="comment">/* File R/W pointer */</span><a name="l00112"></a><a class="code" href="struct__FIL.html#aff39e81f28302c124fe7d82e72275cb">00112</a>         DWORD   <a class="code" href="struct__FIL.html#aff39e81f28302c124fe7d82e72275cb">fsize</a>;                  <span class="comment">/* File size */</span><a name="l00113"></a><a class="code" href="struct__FIL.html#d85363d64b5c973ccc080a3c4521996a">00113</a>         CLUST   <a class="code" href="struct__FIL.html#d85363d64b5c973ccc080a3c4521996a">org_clust</a>;              <span class="comment">/* File start cluster */</span><a name="l00114"></a><a class="code" href="struct__FIL.html#dc4e17d31c45c53968f8b33e72a68eb2">00114</a>         CLUST   <a class="code" href="struct__FIL.html#dc4e17d31c45c53968f8b33e72a68eb2">curr_clust</a>;             <span class="comment">/* Current cluster */</span><a name="l00115"></a><a class="code" href="struct__FIL.html#e2e3327ff44c55930a1241478055a699">00115</a>         DWORD   <a class="code" href="struct__FIL.html#e2e3327ff44c55930a1241478055a699">curr_sect</a>;              <span class="comment">/* Current sector */</span><a name="l00116"></a>00116 <span class="preprocessor">#if !_FS_READONLY</span><a name="l00117"></a><a class="code" href="struct__FIL.html#f68c668d7369856b12c6c3fd64afbd41">00117</a> <span class="preprocessor"></span>        DWORD   <a class="code" href="struct__FIL.html#f68c668d7369856b12c6c3fd64afbd41">dir_sect</a>;               <span class="comment">/* Sector containing the directory entry */</span><a name="l00118"></a><a class="code" href="struct__FIL.html#31104394ea9fe6762ed93f03dd37b9b7">00118</a>         BYTE*   <a class="code" href="struct__FIL.html#31104394ea9fe6762ed93f03dd37b9b7">dir_ptr</a>;                <span class="comment">/* Ponter to the directory entry in the window */</span><a name="l00119"></a>00119 <span class="preprocessor">#endif</span><a name="l00120"></a>00120 <span class="preprocessor"></span>} <a class="code" href="struct__FIL.html">FIL</a>;<a name="l00121"></a>00121 <a name="l00122"></a>00122 <a name="l00123"></a>00123 <span class="comment">/* File status structure */</span><a name="l00124"></a><a class="code" href="struct__FILINFO.html">00124</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct__FILINFO.html">_FILINFO</a> {<a name="l00125"></a><a class="code" href="struct__FILINFO.html#385f3afc63d4bcb8b3ffa9bf233d192e">00125</a>         DWORD <a class="code" href="struct__FILINFO.html#385f3afc63d4bcb8b3ffa9bf233d192e">fsize</a>;                    <span class="comment">/* Size */</span><a name="l00126"></a><a class="code" href="struct__FILINFO.html#02a8fc36e823eb9ebe84d9e7342c218e">00126</a>         WORD <a class="code" href="struct__FILINFO.html#02a8fc36e823eb9ebe84d9e7342c218e">fdate</a>;                             <span class="comment">/* Date */</span><a name="l00127"></a><a class="code" href="struct__FILINFO.html#c9b7c36ac48cb9b7fdd4ca0aae8b00b7">00127</a>         WORD <a class="code" href="struct__FILINFO.html#c9b7c36ac48cb9b7fdd4ca0aae8b00b7">ftime</a>;                             <span class="comment">/* Time */</span><a name="l00128"></a><a class="code" href="struct__FILINFO.html#983a99f79b704ced3a6cb640719aa679">00128</a>         BYTE <a class="code" href="struct__FILINFO.html#983a99f79b704ced3a6cb640719aa679">fattrib</a>;                   <span class="comment">/* Attribute */</span><a name="l00129"></a><a class="code" href="struct__FILINFO.html#7279fa6b57203d143e96021a099e7e57">00129</a>         <span class="keywordtype">char</span> <a class="code" href="struct__FILINFO.html#7279fa6b57203d143e96021a099e7e57">fname</a>[8+1+3+1];    <span class="comment">/* Name (8.3 format) */</span><a name="l00130"></a>00130 } <a class="code" href="struct__FILINFO.html">FILINFO</a>;<a name="l00131"></a>00131 <a name="l00132"></a>00132 <a name="l00133"></a>00133 <span class="comment">/* File function return code (FRESULT) */</span><a name="l00134"></a>00134 <a name="l00135"></a>00135 <span class="keyword">typedef</span> <span class="keyword">enum</span> {<a name="l00136"></a>00136         FR_OK = 0,                      <span class="comment">/* 0 */</span><a name="l00137"></a>00137         FR_NOT_READY,           <span class="comment">/* 1 */</span><a name="l00138"></a>00138         FR_NO_FILE,                     <span class="comment">/* 2 */</span><a name="l00139"></a>00139         FR_NO_PATH,                     <span class="comment">/* 3 */</span><a name="l00140"></a>00140         FR_INVALID_NAME,        <span class="comment">/* 4 */</span><a name="l00141"></a>00141         FR_INVALID_DRIVE,       <span class="comment">/* 5 */</span><a name="l00142"></a>00142         FR_DENIED,                      <span class="comment">/* 6 */</span><a name="l00143"></a>00143         FR_EXIST,                       <span class="comment">/* 7 */</span><a name="l00144"></a>00144         FR_RW_ERROR,            <span class="comment">/* 8 */</span><a name="l00145"></a>00145         FR_WRITE_PROTECTED,     <span class="comment">/* 9 */</span><a name="l00146"></a>00146         FR_NOT_ENABLED,         <span class="comment">/* 10 */</span><a name="l00147"></a>00147         FR_NO_FILESYSTEM,       <span class="comment">/* 11 */</span><a name="l00148"></a>00148         FR_INVALID_OBJECT       <span class="comment">/* 12 */</span><a name="l00149"></a>00149 } FRESULT;<a name="l00150"></a>00150 <a name="l00151"></a>00151 <a name="l00152"></a>00152 <a name="l00153"></a>00153 <span class="comment">/*-----------------------------------------------------*/</span><a name="l00154"></a>00154 <span class="comment">/* FatFs module application interface                  */</span><a name="l00155"></a>00155 <a name="l00156"></a>00156 FRESULT f_mount (BYTE, <a class="code" href="struct__FATFS.html">FATFS</a>*);                                         <span class="comment">/* Mount/Unmount a logical drive */</span><a name="l00157"></a>00157 FRESULT f_open (<a class="code" href="struct__FIL.html">FIL</a>*, <span class="keyword">const</span> <span class="keywordtype">char</span>*, BYTE);                       <span class="comment">/* Open or create a file */</span><a name="l00158"></a>00158 FRESULT f_read (<a class="code" href="struct__FIL.html">FIL</a>*, <span class="keywordtype">void</span>*, WORD, WORD*);                      <span class="comment">/* Read data from a file */</span><a name="l00159"></a>00159 FRESULT f_write (<a class="code" href="struct__FIL.html">FIL</a>*, <span class="keyword">const</span> <span class="keywordtype">void</span>*, WORD, WORD*);       <span class="comment">/* Write data to a file */</span><a name="l00160"></a>00160 FRESULT f_lseek (<a class="code" href="struct__FIL.html">FIL</a>*, DWORD);                                          <span class="comment">/* Move file pointer of a file object */</span><a name="l00161"></a>00161 FRESULT f_close (<a class="code" href="struct__FIL.html">FIL</a>*);                                                         <span class="comment">/* Close an open file object */</span><a name="l00162"></a>00162 FRESULT f_opendir (<a class="code" href="struct__DIR.html">DIR</a>*, <span class="keyword">const</span> <span class="keywordtype">char</span>*);                          <span class="comment">/* Open an existing directory */</span><a name="l00163"></a>00163 FRESULT f_readdir (<a class="code" href="struct__DIR.html">DIR</a>*, <a class="code" href="struct__FILINFO.html">FILINFO</a>*);                                     <span class="comment">/* Read a directory item */</span><a name="l00164"></a>00164 FRESULT f_stat (<span class="keyword">const</span> <span class="keywordtype">char</span>*, <a class="code" href="struct__FILINFO.html">FILINFO</a>*);                         <span class="comment">/* Get file status */</span><a name="l00165"></a>00165 FRESULT f_getfree (<span class="keyword">const</span> <span class="keywordtype">char</span>*, DWORD*, <a class="code" href="struct__FATFS.html">FATFS</a>**);       <span class="comment">/* Get number of free clusters on the drive */</span><a name="l00166"></a>00166 FRESULT f_sync (<a class="code" href="struct__FIL.html">FIL</a>*);                                                          <span class="comment">/* Flush cached data of a writing file */</span><a name="l00167"></a>00167 FRESULT f_unlink (<span class="keyword">const</span> <span class="keywordtype">char</span>*);                                         <span class="comment">/* Delete an existing file or directory */</span><a name="l00168"></a>00168 FRESULT f_mkdir (<span class="keyword">const</span> <span class="keywordtype">char</span>*);                                          <span class="comment">/* Create a new directory */</span><a name="l00169"></a>00169 FRESULT f_chmod (<span class="keyword">const</span> <span class="keywordtype">char</span>*, BYTE, BYTE);                      <span class="comment">/* Change file/dir attriburte */</span><a name="l00170"></a>00170 FRESULT f_rename (<span class="keyword">const</span> <span class="keywordtype">char</span>*, <span class="keyword">const</span> <span class="keywordtype">char</span>*);            <span class="comment">/* Rename/Move a file or directory */</span><a name="l00171"></a>00171 <a name="l00172"></a>00172 <a name="l00173"></a>00173 <span class="comment">/* User defined function to give a current time to fatfs module */</span><a name="l00174"></a>00174 <a name="l00175"></a>00175 DWORD <a class="code" href="main_8c.html#ae5b8f2c0e0985aad8819fc8f8d62d75">get_fattime</a> (<span class="keywordtype">void</span>);       <span class="comment">/* 31-25: Year(0-127 +1980), 24-21: Month(1-12), 20-16: Day(1-31) */</span><a name="l00176"></a>00176                                                         <span class="comment">/* 15-11: Hour(0-23), 10-5: Minute(0-59), 4-0: Second(0-29 *2) */</span><a name="l00177"></a>00177 <a name="l00178"></a>00178 <a name="l00179"></a>00179 <a name="l00180"></a>00180 <span class="comment">/* File access control and file status flags (FIL.flag) */</span><a name="l00181"></a>00181 <a name="l00182"></a>00182 <span class="preprocessor">#define FA_READ                         0x01</span><a name="l00183"></a>00183 <span class="preprocessor"></span><span class="preprocessor">#define FA_OPEN_EXISTING        0x00</span><a name="l00184"></a>00184 <span class="preprocessor"></span><span class="preprocessor">#if !_FS_READONLY</span><a name="l00185"></a>00185 <span class="preprocessor"></span><span class="preprocessor">#define FA_WRITE                        0x02</span><a name="l00186"></a>00186 <span class="preprocessor"></span><span class="preprocessor">#define FA_CREATE_NEW           0x04</span><a name="l00187"></a>00187 <span class="preprocessor"></span><span class="preprocessor">#define FA_CREATE_ALWAYS        0x08</span><a name="l00188"></a>00188 <span class="preprocessor"></span><span class="preprocessor">#define FA_OPEN_ALWAYS          0x10</span><a name="l00189"></a>00189 <span class="preprocessor"></span><span class="preprocessor">#define FA__WRITTEN                     0x20</span><a name="l00190"></a>00190 <span class="preprocessor"></span><span class="preprocessor">#endif</span><a name="l00191"></a>00191 <span class="preprocessor"></span><span class="preprocessor">#define FA__ERROR                       0x80</span><a name="l00192"></a>00192 <span class="preprocessor"></span>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?