diff options
author | Leo C. | 2024-06-30 09:37:28 +0200 |
---|---|---|
committer | Leo C. | 2024-06-30 09:37:28 +0200 |
commit | 5630b9308323c3f3aaa09be8fe0f3aecaa826473 (patch) | |
tree | ad11998289caa623b98507393f838611317ad03e /fatfs/documents/doc/sync.html | |
parent | dbd0d34e68c73b9d3628cc1a1bda0b883976fc8b (diff) | |
download | z180-stamp-5630b9308323c3f3aaa09be8fe0f3aecaa826473.zip |
Import fatfs R0.15fatfs-0.15chan-fatfs
Diffstat (limited to 'fatfs/documents/doc/sync.html')
-rw-r--r-- | fatfs/documents/doc/sync.html | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/fatfs/documents/doc/sync.html b/fatfs/documents/doc/sync.html index a0317d6..9fb42a0 100644 --- a/fatfs/documents/doc/sync.html +++ b/fatfs/documents/doc/sync.html @@ -44,7 +44,30 @@ FRESULT f_sync ( <div class="para desc">
<h4>Description</h4>
-<p>The <tt>f_sync</tt> function performs the same process as <tt>f_close</tt> function but the file is left opened and can continue read/write/seek operations to the file. This is suitable for the applications that open files for a long time in write mode, such as data logger. Performing <tt>f_sync</tt> function of periodic or immediataly after <tt>f_write</tt> function can minimize the risk of data loss due to a sudden blackout or an unintentional media removal. For more information, refer to <a href="appnote.html#critical">application note</a>.</p>
+<p>The <tt>f_sync</tt> function performs the same process as <tt>f_close</tt> function but the file is left opened and can continue read/write/seek operations to the file. This is suitable for the applications that open files for a long time in write mode, such as data logger. Performing <tt>f_sync</tt> function in certain interval can minimize the risk of data loss due to a sudden blackout, wrong media removal or unrecoverable disk error. For more information, refer to <a href="appnote.html#critical">application note</a>.</p>
+<pre>
+Case 1. Normal write sequence
+
+ Time --> ↓Normal shutdown
+OwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwC <Power off>
+
+
+Case 2. Without using f_sync()
+
+ Time --> ↓System crush
+O<span class="e">wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww</span>
+ |<--------------- All data written will be lost ------------------>|
+
+
+Case 3. Using f_sync()
+ Time --> ↓System crush
+OwwwwwwwwSwwwwwwwwSwwwwwwwwSwwwwwwwwSwwwwwwwwSwwwwwwwwSwwwwwwwwS<span class="e">wwwww</span>
+ Data after last f_sync will be lost |<->|
+O - f_open()
+C - f_close()
+w - f_write()
+S - f_sync()
+</pre>
<p>However there is no sense in <tt>f_sync</tt> function immediataly before <tt>f_close</tt> function because it performs <tt>f_sync</tt> function in it. In other words, the differnce between those functions is that the file object is invalidated or not.</p>
</div>
|