]> cloudbase.mooo.com Git - z180-stamp.git/blame - fatfs/doc/en/dwrite.html
Merge branch 'chan-fatfs' into fatfs-integration
[z180-stamp.git] / fatfs / doc / en / dwrite.html
CommitLineData
53668523
L
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">\r
2<html lang="en">\r
3<head>\r
4<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">\r
5<meta http-equiv="Content-Style-Type" content="text/css">\r
6<link rel="up" title="FatFs" href="../00index_e.html">\r
7<link rel="alternate" hreflang="ja" title="Japanese" href="../ja/dwrite.html">\r
8<link rel="stylesheet" href="../css_e.css" type="text/css" media="screen" title="ELM Default">\r
9<title>FatFs - disk_write</title>\r
10</head>\r
11\r
12<body>\r
13\r
14<div class="para func">\r
15<h2>disk_write</h2>\r
16<p>The disk_write writes sector(s) to the storage device.</p>\r
17<pre>\r
18DRESULT disk_write (\r
19 BYTE <span class="arg">drv</span>, <span class="c">/* [IN] Physical drive number */</span>\r
20 const BYTE* <span class="arg">buff</span>, <span class="c">/* [IN] Pointer to the data to be written */</span>\r
21 DWORD <span class="arg">sector</span>, <span class="c">/* [IN] Sector number to write from */</span>\r
22 UINT <span class="arg">count</span> <span class="c">/* [IN] Number of sectors to write */</span>\r
23);\r
24</pre>\r
25</div>\r
26\r
27<div class="para arg">\r
28<h4>Parameters</h4>\r
29<dl class="par">\r
30<dt>pdrv</dt>\r
31<dd>Physical drive number to identify the target device.</dd>\r
32<dt>buff</dt>\r
70702af1 33<dd>Pointer to the first item of the <em>byte array</em> to be written. The size of data to be written is sector size * <tt class="arg">count</tt> bytes.</dd>\r
53668523 34<dt>sector</dt>\r
7b78a5a2 35<dd>Start sector number in 32-bit LBA.</dd>\r
53668523 36<dt>count</dt>\r
70702af1 37<dd>Number of sectors to write.</dd>\r
53668523
L
38</dl>\r
39</div>\r
40\r
41\r
42<div class="para ret">\r
43<h4>Return Values</h4>\r
44<dl class="ret">\r
45<dt>RES_OK (0)</dt>\r
46<dd>The function succeeded.</dd>\r
47<dt>RES_ERROR</dt>\r
48<dd>Any hard error occured during the write operation and could not recover it.</dd>\r
49<dt>RES_WRPRT</dt>\r
50<dd>The medium is write protected.</dd>\r
51<dt>RES_PARERR</dt>\r
52<dd>Invalid parameter.</dd>\r
53<dt>RES_NOTRDY</dt>\r
54<dd>The device has not been initialized.</dd>\r
55</dl>\r
56</div>\r
57\r
58\r
59<div class="para desc">\r
60<h4>Description</h4>\r
70702af1 61<p>The specified memory address is not that always aligned to word boundary because the type of pointer is defined as <tt>BYTE*</tt>. For more information, refer to the description of <a href="dread.html"><tt>disk_read</tt></a> function.</p>\r
53668523 62<p>Generally, a multiple sector transfer request must not be split into single sector transactions to the storage device, or you will never get good write throughput.</p>\r
70702af1
L
63<p>FatFs expects delayed write function of the disk control layer. The write operation to the media does not need to be completed when return from this function by what write operation is in progress or data is only stored into the write-back cache. But write data on the <tt class="arg">buff</tt> is invalid after return from this function. The write completion request is done by <tt>CTRL_SYNC</tt> command of <tt><a href="dioctl.html">disk_ioctl</a></tt> function. Therefore, if a delayed write function is implemented, the write throughput will be improved.</p>\r
64<p><em>Remarks: Application program MUST NOT call this function, or FAT structure on the volume can be collapsed.</em></p>\r
53668523
L
65</div>\r
66\r
67\r
68<div class="para comp">\r
69<h4>QuickInfo</h4>\r
70<p>This function is not needed when <tt>_FS_READONLY == 1</tt>.</p>\r
71</div>\r
72\r
73\r
74<p class="foot"><a href="../00index_e.html">Return</a></p>\r
75</body>\r
76</html>\r