990 lines
54 KiB
HTML
990 lines
54 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
|
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
|
<title>sd-reader: FAT support</title>
|
|
|
|
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
|
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
|
|
|
|
|
|
|
</head>
|
|
<body>
|
|
<div id="top"><!-- do not remove this div! -->
|
|
|
|
|
|
<div id="titlearea">
|
|
<table cellspacing="0" cellpadding="0">
|
|
<tbody>
|
|
<tr style="height: 56px;">
|
|
|
|
|
|
<td style="padding-left: 0.5em;">
|
|
<div id="projectname">sd-reader
|
|
|
|
</div>
|
|
|
|
</td>
|
|
|
|
|
|
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<!-- Generated by Doxygen 1.7.6.1 -->
|
|
<div id="navrow1" class="tabs">
|
|
<ul class="tablist">
|
|
<li><a href="index.html"><span>Main Page</span></a></li>
|
|
<li><a href="modules.html"><span>Modules</span></a></li>
|
|
<li><a href="annotated.html"><span>Data Structures</span></a></li>
|
|
<li><a href="files.html"><span>Files</span></a></li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<div class="header">
|
|
<div class="summary">
|
|
<a href="#nested-classes">Data Structures</a> |
|
|
<a href="#groups">Modules</a> |
|
|
<a href="#files">Files</a> |
|
|
<a href="#func-members">Functions</a> </div>
|
|
<div class="headertitle">
|
|
<div class="title">FAT support</div> </div>
|
|
</div><!--header-->
|
|
<div class="contents">
|
|
|
|
<p>This module implements FAT16/FAT32 read and write access.
|
|
<a href="#details">More...</a></p>
|
|
<table class="memberdecls">
|
|
<tr><td colspan="2"><h2><a name="nested-classes"></a>
|
|
Data Structures</h2></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="structfat__dir__entry__struct.html">fat_dir_entry_struct</a></td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Describes a directory entry. <a href="structfat__dir__entry__struct.html#details">More...</a><br/></td></tr>
|
|
<tr><td colspan="2"><h2><a name="groups"></a>
|
|
Modules</h2></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat__config.html">FAT configuration</a></td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight"><p>Preprocessor defines to configure the FAT implementation. </p>
|
|
<br/></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat__fs.html">FAT access</a></td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight"><p>Basic functions for handling a FAT filesystem. </p>
|
|
<br/></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat__file.html">FAT file functions</a></td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight"><p>Functions for managing files. </p>
|
|
<br/></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat__dir.html">FAT directory functions</a></td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight"><p>Functions for managing directories. </p>
|
|
<br/></td></tr>
|
|
<tr><td colspan="2"><h2><a name="files"></a>
|
|
Files</h2></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">file  </td><td class="memItemRight" valign="bottom"><a class="el" href="fat_8c.html">fat.c</a></td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight"><p>FAT implementation (license: GPLv2 or LGPLv2.1) </p>
|
|
<br/></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">file  </td><td class="memItemRight" valign="bottom"><a class="el" href="fat_8h.html">fat.h</a></td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight"><p>FAT header (license: GPLv2 or LGPLv2.1) </p>
|
|
<br/></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">file  </td><td class="memItemRight" valign="bottom"><a class="el" href="fat__config_8h.html">fat_config.h</a></td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight"><p>FAT configuration (license: GPLv2 or LGPLv2.1) </p>
|
|
<br/></td></tr>
|
|
<tr><td colspan="2"><h2><a name="func-members"></a>
|
|
Functions</h2></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">struct fat_fs_struct * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat.html#ga5d726bac328b49abc2e6fb022d97092a">fat_open</a> (struct <a class="el" href="structpartition__struct.html">partition_struct</a> *partition)</td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Opens a FAT filesystem. <a href="#ga5d726bac328b49abc2e6fb022d97092a"></a><br/></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat.html#ga057612824886e115b88bf5affcf76829">fat_close</a> (struct fat_fs_struct *fs)</td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Closes a FAT filesystem. <a href="#ga057612824886e115b88bf5affcf76829"></a><br/></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">struct fat_file_struct * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat.html#ga76a0b06949525b578db04a56d67fbfc4">fat_open_file</a> (struct fat_fs_struct *fs, const struct <a class="el" href="structfat__dir__entry__struct.html">fat_dir_entry_struct</a> *dir_entry)</td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Opens a file on a FAT filesystem. <a href="#ga76a0b06949525b578db04a56d67fbfc4"></a><br/></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat.html#ga70b082abb4ebc8d4e9956886901b55fc">fat_close_file</a> (struct fat_file_struct *fd)</td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Closes a file. <a href="#ga70b082abb4ebc8d4e9956886901b55fc"></a><br/></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">intptr_t </td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat.html#ga48e17b173bede64cb08cef05b88fd0ca">fat_read_file</a> (struct fat_file_struct *fd, uint8_t *buffer, uintptr_t buffer_len)</td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Reads data from a file. <a href="#ga48e17b173bede64cb08cef05b88fd0ca"></a><br/></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">intptr_t </td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat.html#ga6782ff80eb6fba9b6ed1a66f33dae60a">fat_write_file</a> (struct fat_file_struct *fd, const uint8_t *buffer, uintptr_t buffer_len)</td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Writes data to a file. <a href="#ga6782ff80eb6fba9b6ed1a66f33dae60a"></a><br/></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">uint8_t </td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat.html#gad4c305cf004bae9bea48730ed20c87ec">fat_seek_file</a> (struct fat_file_struct *fd, int32_t *offset, uint8_t whence)</td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Repositions the read/write file offset. <a href="#gad4c305cf004bae9bea48730ed20c87ec"></a><br/></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">uint8_t </td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat.html#gace4858e7a145684f6c8cd14debe14255">fat_resize_file</a> (struct fat_file_struct *fd, uint32_t size)</td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Resizes a file to have a specific size. <a href="#gace4858e7a145684f6c8cd14debe14255"></a><br/></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">struct fat_dir_struct * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat.html#gac7a5b4ad0b972759a965e1afd5bbc87c">fat_open_dir</a> (struct fat_fs_struct *fs, const struct <a class="el" href="structfat__dir__entry__struct.html">fat_dir_entry_struct</a> *dir_entry)</td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Opens a directory. <a href="#gac7a5b4ad0b972759a965e1afd5bbc87c"></a><br/></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat.html#ga2fed74d916370428e3dcf278e7050111">fat_close_dir</a> (struct fat_dir_struct *dd)</td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Closes a directory descriptor. <a href="#ga2fed74d916370428e3dcf278e7050111"></a><br/></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">uint8_t </td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat.html#gab4bc79452dbf5ac2a2f3e1fccafd9534">fat_read_dir</a> (struct fat_dir_struct *dd, struct <a class="el" href="structfat__dir__entry__struct.html">fat_dir_entry_struct</a> *dir_entry)</td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Reads the next directory entry contained within a parent directory. <a href="#gab4bc79452dbf5ac2a2f3e1fccafd9534"></a><br/></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">uint8_t </td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat.html#ga2d74af47cb9fd44f7c974834f810225f">fat_reset_dir</a> (struct fat_dir_struct *dd)</td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Resets a directory handle. <a href="#ga2d74af47cb9fd44f7c974834f810225f"></a><br/></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">uint8_t </td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat.html#ga9d17d09125359dfb440fc57eede40b4f">fat_create_file</a> (struct fat_dir_struct *parent, const char *file, struct <a class="el" href="structfat__dir__entry__struct.html">fat_dir_entry_struct</a> *dir_entry)</td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Creates a file. <a href="#ga9d17d09125359dfb440fc57eede40b4f"></a><br/></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">uint8_t </td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat.html#ga46055219b942eb8d57ffae9dc6447e7c">fat_delete_file</a> (struct fat_fs_struct *fs, struct <a class="el" href="structfat__dir__entry__struct.html">fat_dir_entry_struct</a> *dir_entry)</td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Deletes a file or directory. <a href="#ga46055219b942eb8d57ffae9dc6447e7c"></a><br/></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">uint8_t </td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat.html#gaba4d2c80ccd8f1aebcecf7072dc37510">fat_move_file</a> (struct fat_fs_struct *fs, struct <a class="el" href="structfat__dir__entry__struct.html">fat_dir_entry_struct</a> *dir_entry, struct fat_dir_struct *parent_new, const char *file_new)</td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Moves or renames a file. <a href="#gaba4d2c80ccd8f1aebcecf7072dc37510"></a><br/></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">uint8_t </td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat.html#gaff3b524066c9a937fae32771c80e7603">fat_create_dir</a> (struct fat_dir_struct *parent, const char *dir, struct <a class="el" href="structfat__dir__entry__struct.html">fat_dir_entry_struct</a> *dir_entry)</td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Creates a directory. <a href="#gaff3b524066c9a937fae32771c80e7603"></a><br/></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat.html#ga24763fd73cbeb580ae5d19e975bde0d8">fat_get_file_modification_date</a> (const struct <a class="el" href="structfat__dir__entry__struct.html">fat_dir_entry_struct</a> *dir_entry, uint16_t *year, uint8_t *month, uint8_t *day)</td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the modification date of a file. <a href="#ga24763fd73cbeb580ae5d19e975bde0d8"></a><br/></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat.html#ga74f840c317556b7dae766e199d87a6ef">fat_get_file_modification_time</a> (const struct <a class="el" href="structfat__dir__entry__struct.html">fat_dir_entry_struct</a> *dir_entry, uint8_t *hour, uint8_t *min, uint8_t *sec)</td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the modification time of a file. <a href="#ga74f840c317556b7dae766e199d87a6ef"></a><br/></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">uint8_t </td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat.html#ga033743a7d8878712e0add6d57b750525">fat_get_dir_entry_of_path</a> (struct fat_fs_struct *fs, const char *path, struct <a class="el" href="structfat__dir__entry__struct.html">fat_dir_entry_struct</a> *dir_entry)</td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Retrieves the directory entry of a path. <a href="#ga033743a7d8878712e0add6d57b750525"></a><br/></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">offset_t </td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat.html#gaab7768ca45847d5c4033a91984d65f1a">fat_get_fs_size</a> (const struct fat_fs_struct *fs)</td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the amount of total storage capacity of the filesystem in bytes. <a href="#gaab7768ca45847d5c4033a91984d65f1a"></a><br/></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">offset_t </td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat.html#gacc43179721b97d82fefafaf5625350bb">fat_get_fs_free</a> (const struct fat_fs_struct *fs)</td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the amount of free storage capacity on the filesystem in bytes. <a href="#gacc43179721b97d82fefafaf5625350bb"></a><br/></td></tr>
|
|
</table>
|
|
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
|
|
<p>This module implements FAT16/FAT32 read and write access. </p>
|
|
<p>The following features are supported:</p>
|
|
<ul>
|
|
<li>File names up to 31 characters long.</li>
|
|
<li>Unlimited depth of subdirectories.</li>
|
|
<li>Short 8.3 and long filenames.</li>
|
|
<li>Creating and deleting files.</li>
|
|
<li>Reading and writing from and to files.</li>
|
|
<li>File resizing.</li>
|
|
<li>File sizes of up to 4 gigabytes. </li>
|
|
</ul>
|
|
<hr/><h2>Function Documentation</h2>
|
|
<a class="anchor" id="ga057612824886e115b88bf5affcf76829"></a><!-- doxytag: member="fat.h::fat_close" ref="ga057612824886e115b88bf5affcf76829" args="(struct fat_fs_struct *fs)" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void <a class="el" href="group__fat.html#ga057612824886e115b88bf5affcf76829">fat_close</a> </td>
|
|
<td>(</td>
|
|
<td class="paramtype">struct fat_fs_struct * </td>
|
|
<td class="paramname"><em>fs</em></td><td>)</td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
|
|
<p>Closes a FAT filesystem. </p>
|
|
<p>When this function returns, the given filesystem descriptor will be invalid.</p>
|
|
<dl class="params"><dt><b>Parameters:</b></dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">fs</td><td>The filesystem to close. </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="group__fat.html#ga5d726bac328b49abc2e6fb022d97092a" title="Opens a FAT filesystem.">fat_open</a> </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ga2fed74d916370428e3dcf278e7050111"></a><!-- doxytag: member="fat.h::fat_close_dir" ref="ga2fed74d916370428e3dcf278e7050111" args="(struct fat_dir_struct *dd)" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void <a class="el" href="group__fat.html#ga2fed74d916370428e3dcf278e7050111">fat_close_dir</a> </td>
|
|
<td>(</td>
|
|
<td class="paramtype">struct fat_dir_struct * </td>
|
|
<td class="paramname"><em>dd</em></td><td>)</td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
|
|
<p>Closes a directory descriptor. </p>
|
|
<p>This function destroys a directory descriptor which was previously obtained by calling <a class="el" href="group__fat__dir.html#gac7a5b4ad0b972759a965e1afd5bbc87c" title="Opens a directory.">fat_open_dir()</a>. When this function returns, the given descriptor will be invalid.</p>
|
|
<dl class="params"><dt><b>Parameters:</b></dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">dd</td><td>The directory descriptor to close. </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="group__fat.html#gac7a5b4ad0b972759a965e1afd5bbc87c" title="Opens a directory.">fat_open_dir</a> </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ga70b082abb4ebc8d4e9956886901b55fc"></a><!-- doxytag: member="fat.h::fat_close_file" ref="ga70b082abb4ebc8d4e9956886901b55fc" args="(struct fat_file_struct *fd)" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void <a class="el" href="group__fat.html#ga70b082abb4ebc8d4e9956886901b55fc">fat_close_file</a> </td>
|
|
<td>(</td>
|
|
<td class="paramtype">struct fat_file_struct * </td>
|
|
<td class="paramname"><em>fd</em></td><td>)</td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
|
|
<p>Closes a file. </p>
|
|
<dl class="params"><dt><b>Parameters:</b></dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">fd</td><td>The file handle of the file to close. </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="group__fat.html#ga76a0b06949525b578db04a56d67fbfc4" title="Opens a file on a FAT filesystem.">fat_open_file</a> </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="gaff3b524066c9a937fae32771c80e7603"></a><!-- doxytag: member="fat.h::fat_create_dir" ref="gaff3b524066c9a937fae32771c80e7603" args="(struct fat_dir_struct *parent, const char *dir, struct fat_dir_entry_struct *dir_entry)" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">uint8_t <a class="el" href="group__fat.html#gaff3b524066c9a937fae32771c80e7603">fat_create_dir</a> </td>
|
|
<td>(</td>
|
|
<td class="paramtype">struct fat_dir_struct * </td>
|
|
<td class="paramname"><em>parent</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">const char * </td>
|
|
<td class="paramname"><em>dir</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">struct <a class="el" href="structfat__dir__entry__struct.html">fat_dir_entry_struct</a> * </td>
|
|
<td class="paramname"><em>dir_entry</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
|
|
<p>Creates a directory. </p>
|
|
<p>Creates a directory and obtains its directory entry. If the directory to create already exists, its directory entry will be returned within the dir_entry parameter.</p>
|
|
<dl class="note"><dt><b>Note:</b></dt><dd>The notes which apply to <a class="el" href="group__fat__file.html#ga9d17d09125359dfb440fc57eede40b4f" title="Creates a file.">fat_create_file()</a> also apply to this function.</dd></dl>
|
|
<dl class="params"><dt><b>Parameters:</b></dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">parent</td><td>The handle of the parent directory of the new directory. </td></tr>
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">dir</td><td>The name of the directory to create. </td></tr>
|
|
<tr><td class="paramdir">[out]</td><td class="paramname">dir_entry</td><td>The directory entry to fill for the new directory. </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="return"><dt><b>Returns:</b></dt><dd>0 on failure, 1 on success. </dd></dl>
|
|
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="group__fat__dir.html#gac0b6889e84a48b2d69fd681e5ac2e772" title="Deletes a directory.">fat_delete_dir</a> </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ga9d17d09125359dfb440fc57eede40b4f"></a><!-- doxytag: member="fat.h::fat_create_file" ref="ga9d17d09125359dfb440fc57eede40b4f" args="(struct fat_dir_struct *parent, const char *file, struct fat_dir_entry_struct *dir_entry)" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">uint8_t <a class="el" href="group__fat.html#ga9d17d09125359dfb440fc57eede40b4f">fat_create_file</a> </td>
|
|
<td>(</td>
|
|
<td class="paramtype">struct fat_dir_struct * </td>
|
|
<td class="paramname"><em>parent</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">const char * </td>
|
|
<td class="paramname"><em>file</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">struct <a class="el" href="structfat__dir__entry__struct.html">fat_dir_entry_struct</a> * </td>
|
|
<td class="paramname"><em>dir_entry</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
|
|
<p>Creates a file. </p>
|
|
<p>Creates a file and obtains the directory entry of the new file. If the file to create already exists, the directory entry of the existing file will be returned within the dir_entry parameter.</p>
|
|
<dl class="note"><dt><b>Note:</b></dt><dd>The file name is not checked for invalid characters.</dd>
|
|
<dd>
|
|
The generation of the short 8.3 file name is quite simple. The first eight characters are used for the filename. The extension, if any, is made up of the first three characters following the last dot within the long filename. If the filename (without the extension) is longer than eight characters, the lower byte of the cluster number replaces the last two characters to avoid name clashes. In any other case, it is your responsibility to avoid name clashes.</dd></dl>
|
|
<dl class="params"><dt><b>Parameters:</b></dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">parent</td><td>The handle of the directory in which to create the file. </td></tr>
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">file</td><td>The name of the file to create. </td></tr>
|
|
<tr><td class="paramdir">[out]</td><td class="paramname">dir_entry</td><td>The directory entry to fill for the new (or existing) file. </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="return"><dt><b>Returns:</b></dt><dd>0 on failure, 1 on success, 2 if the file already existed. </dd></dl>
|
|
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="group__fat.html#ga46055219b942eb8d57ffae9dc6447e7c" title="Deletes a file or directory.">fat_delete_file</a> </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ga46055219b942eb8d57ffae9dc6447e7c"></a><!-- doxytag: member="fat.h::fat_delete_file" ref="ga46055219b942eb8d57ffae9dc6447e7c" args="(struct fat_fs_struct *fs, struct fat_dir_entry_struct *dir_entry)" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">uint8_t <a class="el" href="group__fat.html#ga46055219b942eb8d57ffae9dc6447e7c">fat_delete_file</a> </td>
|
|
<td>(</td>
|
|
<td class="paramtype">struct fat_fs_struct * </td>
|
|
<td class="paramname"><em>fs</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">struct <a class="el" href="structfat__dir__entry__struct.html">fat_dir_entry_struct</a> * </td>
|
|
<td class="paramname"><em>dir_entry</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
|
|
<p>Deletes a file or directory. </p>
|
|
<p>If a directory is deleted without first deleting its subdirectories and files, disk space occupied by these files will get wasted as there is no chance to release it and mark it as free.</p>
|
|
<dl class="params"><dt><b>Parameters:</b></dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">fs</td><td>The filesystem on which to operate. </td></tr>
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">dir_entry</td><td>The directory entry of the file to delete. </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="return"><dt><b>Returns:</b></dt><dd>0 on failure, 1 on success. </dd></dl>
|
|
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="group__fat.html#ga9d17d09125359dfb440fc57eede40b4f" title="Creates a file.">fat_create_file</a> </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ga033743a7d8878712e0add6d57b750525"></a><!-- doxytag: member="fat.h::fat_get_dir_entry_of_path" ref="ga033743a7d8878712e0add6d57b750525" args="(struct fat_fs_struct *fs, const char *path, struct fat_dir_entry_struct *dir_entry)" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">uint8_t <a class="el" href="group__fat.html#ga033743a7d8878712e0add6d57b750525">fat_get_dir_entry_of_path</a> </td>
|
|
<td>(</td>
|
|
<td class="paramtype">struct fat_fs_struct * </td>
|
|
<td class="paramname"><em>fs</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">const char * </td>
|
|
<td class="paramname"><em>path</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">struct <a class="el" href="structfat__dir__entry__struct.html">fat_dir_entry_struct</a> * </td>
|
|
<td class="paramname"><em>dir_entry</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
|
|
<p>Retrieves the directory entry of a path. </p>
|
|
<p>The given path may both describe a file or a directory.</p>
|
|
<dl class="params"><dt><b>Parameters:</b></dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">fs</td><td>The FAT filesystem on which to search. </td></tr>
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">path</td><td>The path of which to read the directory entry. </td></tr>
|
|
<tr><td class="paramdir">[out]</td><td class="paramname">dir_entry</td><td>The directory entry to fill. </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="return"><dt><b>Returns:</b></dt><dd>0 on failure, 1 on success. </dd></dl>
|
|
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="group__fat.html#gab4bc79452dbf5ac2a2f3e1fccafd9534" title="Reads the next directory entry contained within a parent directory.">fat_read_dir</a> </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ga24763fd73cbeb580ae5d19e975bde0d8"></a><!-- doxytag: member="fat.h::fat_get_file_modification_date" ref="ga24763fd73cbeb580ae5d19e975bde0d8" args="(const struct fat_dir_entry_struct *dir_entry, uint16_t *year, uint8_t *month, uint8_t *day)" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void <a class="el" href="group__fat.html#ga24763fd73cbeb580ae5d19e975bde0d8">fat_get_file_modification_date</a> </td>
|
|
<td>(</td>
|
|
<td class="paramtype">const struct <a class="el" href="structfat__dir__entry__struct.html">fat_dir_entry_struct</a> * </td>
|
|
<td class="paramname"><em>dir_entry</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">uint16_t * </td>
|
|
<td class="paramname"><em>year</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">uint8_t * </td>
|
|
<td class="paramname"><em>month</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">uint8_t * </td>
|
|
<td class="paramname"><em>day</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
|
|
<p>Returns the modification date of a file. </p>
|
|
<dl class="params"><dt><b>Parameters:</b></dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">dir_entry</td><td>The directory entry of which to return the modification date. </td></tr>
|
|
<tr><td class="paramdir">[out]</td><td class="paramname">year</td><td>The year the file was last modified. </td></tr>
|
|
<tr><td class="paramdir">[out]</td><td class="paramname">month</td><td>The month the file was last modified. </td></tr>
|
|
<tr><td class="paramdir">[out]</td><td class="paramname">day</td><td>The day the file was last modified. </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ga74f840c317556b7dae766e199d87a6ef"></a><!-- doxytag: member="fat.h::fat_get_file_modification_time" ref="ga74f840c317556b7dae766e199d87a6ef" args="(const struct fat_dir_entry_struct *dir_entry, uint8_t *hour, uint8_t *min, uint8_t *sec)" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void <a class="el" href="group__fat.html#ga74f840c317556b7dae766e199d87a6ef">fat_get_file_modification_time</a> </td>
|
|
<td>(</td>
|
|
<td class="paramtype">const struct <a class="el" href="structfat__dir__entry__struct.html">fat_dir_entry_struct</a> * </td>
|
|
<td class="paramname"><em>dir_entry</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">uint8_t * </td>
|
|
<td class="paramname"><em>hour</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">uint8_t * </td>
|
|
<td class="paramname"><em>min</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">uint8_t * </td>
|
|
<td class="paramname"><em>sec</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
|
|
<p>Returns the modification time of a file. </p>
|
|
<dl class="params"><dt><b>Parameters:</b></dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">dir_entry</td><td>The directory entry of which to return the modification time. </td></tr>
|
|
<tr><td class="paramdir">[out]</td><td class="paramname">hour</td><td>The hour the file was last modified. </td></tr>
|
|
<tr><td class="paramdir">[out]</td><td class="paramname">min</td><td>The min the file was last modified. </td></tr>
|
|
<tr><td class="paramdir">[out]</td><td class="paramname">sec</td><td>The sec the file was last modified. </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="gacc43179721b97d82fefafaf5625350bb"></a><!-- doxytag: member="fat.h::fat_get_fs_free" ref="gacc43179721b97d82fefafaf5625350bb" args="(const struct fat_fs_struct *fs)" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">offset_t <a class="el" href="group__fat.html#gacc43179721b97d82fefafaf5625350bb">fat_get_fs_free</a> </td>
|
|
<td>(</td>
|
|
<td class="paramtype">const struct fat_fs_struct * </td>
|
|
<td class="paramname"><em>fs</em></td><td>)</td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
|
|
<p>Returns the amount of free storage capacity on the filesystem in bytes. </p>
|
|
<dl class="note"><dt><b>Note:</b></dt><dd>As the FAT filesystem is cluster based, this function does not return continuous values but multiples of the cluster size.</dd></dl>
|
|
<dl class="params"><dt><b>Parameters:</b></dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">fs</td><td>The filesystem on which to operate. </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="return"><dt><b>Returns:</b></dt><dd>0 on failure, the free filesystem space in bytes otherwise. </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="gaab7768ca45847d5c4033a91984d65f1a"></a><!-- doxytag: member="fat.h::fat_get_fs_size" ref="gaab7768ca45847d5c4033a91984d65f1a" args="(const struct fat_fs_struct *fs)" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">offset_t <a class="el" href="group__fat.html#gaab7768ca45847d5c4033a91984d65f1a">fat_get_fs_size</a> </td>
|
|
<td>(</td>
|
|
<td class="paramtype">const struct fat_fs_struct * </td>
|
|
<td class="paramname"><em>fs</em></td><td>)</td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
|
|
<p>Returns the amount of total storage capacity of the filesystem in bytes. </p>
|
|
<dl class="params"><dt><b>Parameters:</b></dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">fs</td><td>The filesystem on which to operate. </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="return"><dt><b>Returns:</b></dt><dd>0 on failure, the filesystem size in bytes otherwise. </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="gaba4d2c80ccd8f1aebcecf7072dc37510"></a><!-- doxytag: member="fat.h::fat_move_file" ref="gaba4d2c80ccd8f1aebcecf7072dc37510" args="(struct fat_fs_struct *fs, struct fat_dir_entry_struct *dir_entry, struct fat_dir_struct *parent_new, const char *file_new)" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">uint8_t <a class="el" href="group__fat.html#gaba4d2c80ccd8f1aebcecf7072dc37510">fat_move_file</a> </td>
|
|
<td>(</td>
|
|
<td class="paramtype">struct fat_fs_struct * </td>
|
|
<td class="paramname"><em>fs</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">struct <a class="el" href="structfat__dir__entry__struct.html">fat_dir_entry_struct</a> * </td>
|
|
<td class="paramname"><em>dir_entry</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">struct fat_dir_struct * </td>
|
|
<td class="paramname"><em>parent_new</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">const char * </td>
|
|
<td class="paramname"><em>file_new</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
|
|
<p>Moves or renames a file. </p>
|
|
<p>Changes a file's name, optionally moving it into another directory as well. Before calling this function, the target file name must not exist. Moving a file to a different filesystem (i.e. <em>parent_new</em> doesn't lie on <em>fs</em>) is not supported.</p>
|
|
<p>After successfully renaming (and moving) the file, the given directory entry is updated such that it points to the file's new location.</p>
|
|
<dl class="note"><dt><b>Note:</b></dt><dd>The notes which apply to <a class="el" href="group__fat__file.html#ga9d17d09125359dfb440fc57eede40b4f" title="Creates a file.">fat_create_file()</a> also apply to this function.</dd></dl>
|
|
<dl class="params"><dt><b>Parameters:</b></dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">fs</td><td>The filesystem on which to operate. </td></tr>
|
|
<tr><td class="paramdir">[in,out]</td><td class="paramname">dir_entry</td><td>The directory entry of the file to move. </td></tr>
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">parent_new</td><td>The handle of the new parent directory of the file. </td></tr>
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">file_new</td><td>The file's new name. </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="return"><dt><b>Returns:</b></dt><dd>0 on failure, 1 on success. </dd></dl>
|
|
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="group__fat.html#ga9d17d09125359dfb440fc57eede40b4f" title="Creates a file.">fat_create_file</a>, <a class="el" href="group__fat.html#ga46055219b942eb8d57ffae9dc6447e7c" title="Deletes a file or directory.">fat_delete_file</a>, <a class="el" href="group__fat__dir.html#ga8c448f10b372823ce01b39fefb0679b9" title="Moves or renames a directory.">fat_move_dir</a> </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ga5d726bac328b49abc2e6fb022d97092a"></a><!-- doxytag: member="fat.h::fat_open" ref="ga5d726bac328b49abc2e6fb022d97092a" args="(struct partition_struct *partition)" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">struct fat_fs_struct* <a class="el" href="group__fat.html#ga5d726bac328b49abc2e6fb022d97092a">fat_open</a> </td>
|
|
<td>(</td>
|
|
<td class="paramtype">struct <a class="el" href="structpartition__struct.html">partition_struct</a> * </td>
|
|
<td class="paramname"><em>partition</em></td><td>)</td>
|
|
<td><code> [read]</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
|
|
<p>Opens a FAT filesystem. </p>
|
|
<dl class="params"><dt><b>Parameters:</b></dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">partition</td><td>Discriptor of partition on which the filesystem resides. </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="return"><dt><b>Returns:</b></dt><dd>0 on error, a FAT filesystem descriptor on success. </dd></dl>
|
|
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="group__fat.html#ga057612824886e115b88bf5affcf76829" title="Closes a FAT filesystem.">fat_close</a> </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="gac7a5b4ad0b972759a965e1afd5bbc87c"></a><!-- doxytag: member="fat.h::fat_open_dir" ref="gac7a5b4ad0b972759a965e1afd5bbc87c" args="(struct fat_fs_struct *fs, const struct fat_dir_entry_struct *dir_entry)" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">struct fat_dir_struct* <a class="el" href="group__fat.html#gac7a5b4ad0b972759a965e1afd5bbc87c">fat_open_dir</a> </td>
|
|
<td>(</td>
|
|
<td class="paramtype">struct fat_fs_struct * </td>
|
|
<td class="paramname"><em>fs</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">const struct <a class="el" href="structfat__dir__entry__struct.html">fat_dir_entry_struct</a> * </td>
|
|
<td class="paramname"><em>dir_entry</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td><code> [read]</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
|
|
<p>Opens a directory. </p>
|
|
<dl class="params"><dt><b>Parameters:</b></dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">fs</td><td>The filesystem on which the directory to open resides. </td></tr>
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">dir_entry</td><td>The directory entry which stands for the directory to open. </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="return"><dt><b>Returns:</b></dt><dd>An opaque directory descriptor on success, 0 on failure. </dd></dl>
|
|
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="group__fat.html#ga2fed74d916370428e3dcf278e7050111" title="Closes a directory descriptor.">fat_close_dir</a> </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ga76a0b06949525b578db04a56d67fbfc4"></a><!-- doxytag: member="fat.h::fat_open_file" ref="ga76a0b06949525b578db04a56d67fbfc4" args="(struct fat_fs_struct *fs, const struct fat_dir_entry_struct *dir_entry)" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">struct fat_file_struct* <a class="el" href="group__fat.html#ga76a0b06949525b578db04a56d67fbfc4">fat_open_file</a> </td>
|
|
<td>(</td>
|
|
<td class="paramtype">struct fat_fs_struct * </td>
|
|
<td class="paramname"><em>fs</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">const struct <a class="el" href="structfat__dir__entry__struct.html">fat_dir_entry_struct</a> * </td>
|
|
<td class="paramname"><em>dir_entry</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td><code> [read]</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
|
|
<p>Opens a file on a FAT filesystem. </p>
|
|
<dl class="params"><dt><b>Parameters:</b></dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">fs</td><td>The filesystem on which the file to open lies. </td></tr>
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">dir_entry</td><td>The directory entry of the file to open. </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="return"><dt><b>Returns:</b></dt><dd>The file handle, or 0 on failure. </dd></dl>
|
|
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="group__fat.html#ga70b082abb4ebc8d4e9956886901b55fc" title="Closes a file.">fat_close_file</a> </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="gab4bc79452dbf5ac2a2f3e1fccafd9534"></a><!-- doxytag: member="fat.h::fat_read_dir" ref="gab4bc79452dbf5ac2a2f3e1fccafd9534" args="(struct fat_dir_struct *dd, struct fat_dir_entry_struct *dir_entry)" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">uint8_t <a class="el" href="group__fat.html#gab4bc79452dbf5ac2a2f3e1fccafd9534">fat_read_dir</a> </td>
|
|
<td>(</td>
|
|
<td class="paramtype">struct fat_dir_struct * </td>
|
|
<td class="paramname"><em>dd</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">struct <a class="el" href="structfat__dir__entry__struct.html">fat_dir_entry_struct</a> * </td>
|
|
<td class="paramname"><em>dir_entry</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
|
|
<p>Reads the next directory entry contained within a parent directory. </p>
|
|
<dl class="params"><dt><b>Parameters:</b></dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">dd</td><td>The descriptor of the parent directory from which to read the entry. </td></tr>
|
|
<tr><td class="paramdir">[out]</td><td class="paramname">dir_entry</td><td>Pointer to a buffer into which to write the directory entry information. </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="return"><dt><b>Returns:</b></dt><dd>0 on failure, 1 on success. </dd></dl>
|
|
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="group__fat.html#ga2d74af47cb9fd44f7c974834f810225f" title="Resets a directory handle.">fat_reset_dir</a> </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ga48e17b173bede64cb08cef05b88fd0ca"></a><!-- doxytag: member="fat.h::fat_read_file" ref="ga48e17b173bede64cb08cef05b88fd0ca" args="(struct fat_file_struct *fd, uint8_t *buffer, uintptr_t buffer_len)" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">intptr_t <a class="el" href="group__fat.html#ga48e17b173bede64cb08cef05b88fd0ca">fat_read_file</a> </td>
|
|
<td>(</td>
|
|
<td class="paramtype">struct fat_file_struct * </td>
|
|
<td class="paramname"><em>fd</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">uint8_t * </td>
|
|
<td class="paramname"><em>buffer</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">uintptr_t </td>
|
|
<td class="paramname"><em>buffer_len</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
|
|
<p>Reads data from a file. </p>
|
|
<p>The data requested is read from the current file location.</p>
|
|
<dl class="params"><dt><b>Parameters:</b></dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">fd</td><td>The file handle of the file from which to read. </td></tr>
|
|
<tr><td class="paramdir">[out]</td><td class="paramname">buffer</td><td>The buffer into which to write. </td></tr>
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">buffer_len</td><td>The amount of data to read. </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="return"><dt><b>Returns:</b></dt><dd>The number of bytes read, 0 on end of file, or -1 on failure. </dd></dl>
|
|
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="group__fat.html#ga6782ff80eb6fba9b6ed1a66f33dae60a" title="Writes data to a file.">fat_write_file</a> </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ga2d74af47cb9fd44f7c974834f810225f"></a><!-- doxytag: member="fat.h::fat_reset_dir" ref="ga2d74af47cb9fd44f7c974834f810225f" args="(struct fat_dir_struct *dd)" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">uint8_t <a class="el" href="group__fat.html#ga2d74af47cb9fd44f7c974834f810225f">fat_reset_dir</a> </td>
|
|
<td>(</td>
|
|
<td class="paramtype">struct fat_dir_struct * </td>
|
|
<td class="paramname"><em>dd</em></td><td>)</td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
|
|
<p>Resets a directory handle. </p>
|
|
<p>Resets the directory handle such that reading restarts with the first directory entry.</p>
|
|
<dl class="params"><dt><b>Parameters:</b></dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">dd</td><td>The directory handle to reset. </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="return"><dt><b>Returns:</b></dt><dd>0 on failure, 1 on success. </dd></dl>
|
|
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="group__fat.html#gab4bc79452dbf5ac2a2f3e1fccafd9534" title="Reads the next directory entry contained within a parent directory.">fat_read_dir</a> </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="gace4858e7a145684f6c8cd14debe14255"></a><!-- doxytag: member="fat.h::fat_resize_file" ref="gace4858e7a145684f6c8cd14debe14255" args="(struct fat_file_struct *fd, uint32_t size)" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">uint8_t <a class="el" href="group__fat.html#gace4858e7a145684f6c8cd14debe14255">fat_resize_file</a> </td>
|
|
<td>(</td>
|
|
<td class="paramtype">struct fat_file_struct * </td>
|
|
<td class="paramname"><em>fd</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">uint32_t </td>
|
|
<td class="paramname"><em>size</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
|
|
<p>Resizes a file to have a specific size. </p>
|
|
<p>Enlarges or shrinks the file pointed to by the file descriptor to have exactly the specified size.</p>
|
|
<p>If the file is truncated, all bytes having an equal or larger offset than the given size are lost. If the file is expanded, the additional bytes are allocated.</p>
|
|
<dl class="note"><dt><b>Note:</b></dt><dd>Please be aware that this function just allocates or deallocates disk space, it does not explicitely clear it. To avoid data leakage, this must be done manually.</dd></dl>
|
|
<dl class="params"><dt><b>Parameters:</b></dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">fd</td><td>The file decriptor of the file which to resize. </td></tr>
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">size</td><td>The new size of the file. </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="return"><dt><b>Returns:</b></dt><dd>0 on failure, 1 on success. </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="gad4c305cf004bae9bea48730ed20c87ec"></a><!-- doxytag: member="fat.h::fat_seek_file" ref="gad4c305cf004bae9bea48730ed20c87ec" args="(struct fat_file_struct *fd, int32_t *offset, uint8_t whence)" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">uint8_t <a class="el" href="group__fat.html#gad4c305cf004bae9bea48730ed20c87ec">fat_seek_file</a> </td>
|
|
<td>(</td>
|
|
<td class="paramtype">struct fat_file_struct * </td>
|
|
<td class="paramname"><em>fd</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">int32_t * </td>
|
|
<td class="paramname"><em>offset</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">uint8_t </td>
|
|
<td class="paramname"><em>whence</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
|
|
<p>Repositions the read/write file offset. </p>
|
|
<p>Changes the file offset where the next call to <a class="el" href="group__fat__file.html#ga48e17b173bede64cb08cef05b88fd0ca" title="Reads data from a file.">fat_read_file()</a> or <a class="el" href="group__fat__file.html#ga6782ff80eb6fba9b6ed1a66f33dae60a" title="Writes data to a file.">fat_write_file()</a> starts reading/writing.</p>
|
|
<p>If the new offset is beyond the end of the file, <a class="el" href="group__fat__file.html#gace4858e7a145684f6c8cd14debe14255" title="Resizes a file to have a specific size.">fat_resize_file()</a> is implicitly called, i.e. the file is expanded.</p>
|
|
<p>The new offset can be given in different ways determined by the <code>whence</code> parameter:</p>
|
|
<ul>
|
|
<li><b>FAT_SEEK_SET:</b> <code>*offset</code> is relative to the beginning of the file.</li>
|
|
<li><b>FAT_SEEK_CUR:</b> <code>*offset</code> is relative to the current file position.</li>
|
|
<li><b>FAT_SEEK_END:</b> <code>*offset</code> is relative to the end of the file.</li>
|
|
</ul>
|
|
<p>The resulting absolute offset is written to the location the <code>offset</code> parameter points to.</p>
|
|
<p>Calling this function can also be used to retrieve the current file position: </p>
|
|
<div class="fragment"><pre class="fragment"> int32_t file_pos = 0;
|
|
<span class="keywordflow">if</span>(!<a class="code" href="group__fat__file.html#gad4c305cf004bae9bea48730ed20c87ec" title="Repositions the read/write file offset.">fat_seek_file</a>(fd, &file_pos, <a class="code" href="group__fat__file.html#gadba54c574b9a738c8b766ea3b40eeef2" title="The given offset is relative to the current read/write position.">FAT_SEEK_CUR</a>))
|
|
{
|
|
<span class="comment">// error</span>
|
|
}
|
|
<span class="comment">// file_pos now contains the absolute file position</span>
|
|
</pre></div><dl class="params"><dt><b>Parameters:</b></dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">fd</td><td>The file decriptor of the file on which to seek. </td></tr>
|
|
<tr><td class="paramdir">[in,out]</td><td class="paramname">offset</td><td>A pointer to the new offset, as affected by the <code>whence</code> parameter. The function writes the new absolute offset to this location before it returns. </td></tr>
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">whence</td><td>Affects the way <code>offset</code> is interpreted, see above. </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="return"><dt><b>Returns:</b></dt><dd>0 on failure, 1 on success. </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ga6782ff80eb6fba9b6ed1a66f33dae60a"></a><!-- doxytag: member="fat.h::fat_write_file" ref="ga6782ff80eb6fba9b6ed1a66f33dae60a" args="(struct fat_file_struct *fd, const uint8_t *buffer, uintptr_t buffer_len)" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">intptr_t <a class="el" href="group__fat.html#ga6782ff80eb6fba9b6ed1a66f33dae60a">fat_write_file</a> </td>
|
|
<td>(</td>
|
|
<td class="paramtype">struct fat_file_struct * </td>
|
|
<td class="paramname"><em>fd</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">const uint8_t * </td>
|
|
<td class="paramname"><em>buffer</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">uintptr_t </td>
|
|
<td class="paramname"><em>buffer_len</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
|
|
<p>Writes data to a file. </p>
|
|
<p>The data is written to the current file location.</p>
|
|
<dl class="params"><dt><b>Parameters:</b></dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">fd</td><td>The file handle of the file to which to write. </td></tr>
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">buffer</td><td>The buffer from which to read the data to be written. </td></tr>
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">buffer_len</td><td>The amount of data to write. </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="return"><dt><b>Returns:</b></dt><dd>The number of bytes written (0 or something less than <code>buffer_len</code> on disk full) or -1 on failure. </dd></dl>
|
|
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="group__fat.html#ga48e17b173bede64cb08cef05b88fd0ca" title="Reads data from a file.">fat_read_file</a> </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
</div><!-- contents -->
|
|
|
|
|
|
<hr class="footer"/><address class="footer"><small>
|
|
Generated on Tue Jun 12 2012 20:06:45 for sd-reader by  <a href="http://www.doxygen.org/index.html">
|
|
<img class="footer" src="doxygen.png" alt="doxygen"/>
|
|
</a> 1.7.6.1
|
|
</small></address>
|
|
|
|
</body>
|
|
</html>
|