1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<html>
3
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
6<META http-equiv="Content-Style-Type" content="text/css">
7<LINK rel="stylesheet" type="text/css" href="../CSS/revolution.css">
8<title>NANDReadDirAsync</title>
9</head>
10
11<body>
12
13<h1>NANDReadDirAsync</h1>
14
15<h2>Syntax</h2>
16<dl><dd><pre class="construction">
17#include &lt;revolution/nand.h&gt;
18
19#define NAND_MAX_NAME          12
20
21typedef void (*NANDCallback)( s32 result, NANDCommandBlock *block );
22
23s32 NANDReadDirAsync( const char *dirName, char *nameList, u32 *num, NANDCallback cb, NANDCommandBlock *block );
24</pre></dd></dl>
25
26<h2>Arguments</h2>
27<p>
28<TABLE class="arguments" border="1" >
29  <tr>
30<TH>dirName</TH>
31<TD>Directory name.</TD>
32  </tr>
33  <tr>
34<TH>nameList</TH>
35<TD>Buffer start address for storing a list of the files and directories contained in the specified directory. This buffer must be 32-byte aligned. No list is stored if <CODE>NULL</CODE> is specified.</TD>
36  </tr>
37  <tr>
38<TH>num</TH>
39<TD>When <CODE>NULL</CODE> is given for <SPAN class="argument">nameList</SPAN>, <SPAN class="argument">*num</SPAN> stores the number of files and directories that are contained in <SPAN class="argument">dirName</SPAN>. When a buffer address (non-<CODE>NULL</CODE>) is given for <SPAN class="argument">nameList</SPAN>, the file and directory names are written to the <SPAN class="argument">nameList</SPAN> buffer with the value of <SPAN class="argument">*num</SPAN> as the upper limit. The number of files and directories that were actually gotten from <SPAN class="argument">dirName</SPAN> is stored in <SPAN class="argument">*num</SPAN>.</TD>
40  </tr>
41  <tr>
42<TH>cb</TH>
43<TD>Callback function to call when this function completes processing.</TD>
44  </tr>
45  <tr>
46<TH>block</TH>
47<TD>Command block structure to be passed to the callback function.</TD>
48  </tr>
49</TABLE>
50</p>
51
52<h2>Return Values</h2>
53<p>
54The result codes that may be returned by <code>NANDReadDirAsync</code> are listed below. Returns <CODE>NAND_RESULT_OK</CODE> when the request begins normally.
55<p>
56<code>
57NAND_RESULT_OK<br>
58NAND_RESULT_ACCESS<br>
59NAND_RESULT_ALLOC_FAILED<br>
60NAND_RESULT_BUSY<br>
61NAND_RESULT_INVALID<br>
62NAND_RESULT_FATAL_ERROR<br>
63</code>
64</p>
65<p>
66The result codes that may be passed to the callback function are listed below.
67</p>
68<p>
69<code>
70NAND_RESULT_OK<br>
71NAND_RESULT_ACCESS<br>
72NAND_RESULT_INVALID<br>
73NAND_RESULT_NOEXISTS<br>
74NAND_RESULT_UNKNOWN<br>
75NAND_RESULT_FATAL_ERROR<br>
76</code>
77</p>
78</p>
79
80<H2>Description</H2>
81<p>
82Asynchronously gets a list of files and directories contained in the specified directory. If the list size is unknown, retrieve the list using the following steps.
83<ol>
84<li>Call this function with <code>NULL</code> specified as the second argument. The number of elements in the list will be written to the memory region indicated by <SPAN class="argument">num</SPAN>.
85<li>Allocate a memory region whose size is = <code>(Number of elements) * (NAND_MAX_NAME+1)</code> <font color="#ff0000">rounded up to a multiple of 32 bytes.</font>
86<li>Call this function again with the allocated memory start address as the second argument.
87<li>The number of retrieved list elements is stored in <SPAN class="argument">num</SPAN> (this value may be less than its value obtained the first call to this function), and the list of files and directories is stored in the allocated memory using null character separators.
88</ol>
89</p>
90<p>
91<code>NAND_RESULT_BUSY</code> is returned and this function call is denied when the library's internal queue for accepting requests is full.
92</p>
93
94<h2>See Also</h2>
95<p class="reference">
96<a href="./NANDReadDir.html">NANDReadDir</a>
97</p>
98
99<H2>Revision History</H2>
100<p>
1012008/08/01 Revised the result codes that are passed to the callback function.<br>2008/05/13 Described the result codes passed to the callback function.<br>2007/06/xx The description of the third argument was revised because it was insufficient.<br>2006/09/07 Added text about allocating memory of a size rounded up to a multiple of 32 bytes.<br>2006/06/16 Initial version.<br>
102</p>
103
104<hr><p>CONFIDENTIAL</p></body>
105</html>
106