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>C Specification</h2>
16<dl><dd><pre><code>
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</code></pre></dd></dl>
25
26<h2>Arguments</h2>
27<p>
28<TABLE border="1" >
29  <tr>
30<TD valign="top" width="120" bgcolor="#ffffe8"><CODE><STRONG><EM>dirName</EM></STRONG></CODE></TD>
31<TD width="520">Directory name.</TD>
32  </tr>
33  <tr>
34<TD valign="top" width="120" bgcolor="#ffffe8"><CODE><STRONG><EM>nameList</EM></STRONG></CODE></TD>
35<TD width="520">Buffer start address for storing the file and directory list that is contained in the specified directory. This buffer must be 32-byte aligned. If NULL is specified, the list is not stored.</TD>
36  </tr>
37  <tr>
38<TD valign="top" width="120" bgcolor="#ffffe8"><CODE><STRONG><EM>num</EM></STRONG></CODE></TD>
39<TD width="520">If <code>nameList</code> is NULL, the number of files/directories contained in <code>dirName</code> will be stored in <code>*num</code>. If a (non-NULL) buffer address is given in <code>nameList</code>, the file name/directory name will be written to the <code>nameList</code> buffer as an upper limit to the value of <code>*num</code>, and the number of files/directories that were actually obtained from <code>dirName</code> will be stored in <code>*num</code>.</TD>
40  </tr>
41  <tr>
42<TD valign="top" width="120" bgcolor="#ffffe8"><CODE><STRONG><EM>cb</EM></STRONG></CODE></TD>
43<TD width="520">Callback function to call when this function completes processing.</TD>
44  </tr>
45  <tr>
46<TD valign="top" width="120" bgcolor="#ffffe8"><CODE><STRONG><EM>block</EM></STRONG></CODE></TD>
47<TD width="520">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>
54Returns <CODE>NAND_RESULT_OK</CODE> when the request begins normally.
55<p>
56<code>NAND_RESULT_OK<br> NAND_RESULT_ACCESS<br> NAND_RESULT_ALLOC_FAILED<br> NAND_RESULT_BUSY<br> NAND_RESULT_INVALID<br> NAND_RESULT_NOEXISTS<br> NAND_RESULT_UNKNOWN<br> NAND_RESULT_FATAL_ERROR<br></code>
57</p>
58</p>
59
60<H2>Description</H2>
61<p>
62Asynchronously 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.
63<ol>
64<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 that <STRONG><EM><CODE>num</CODE></EM></STRONG> points to.
65<li>Secure a memory region whose size is = <code>(Number of elements) x (NAND_MAX_NAME+1)</code> <font color=#ff0000>rounded up to a multiple of 32 bytes.</font>
66<li>Call this function again with the allocated memory start address as the second argument.
67<li>The number of elements of the list that was retrieved is stored in <STRONG><EM><CODE>num</CODE></EM></STRONG> (this value may be less than the value in the first call to this function), and the file and directory list with a null character separator is stored in the allocated memory.
68</ol>
69</p>
70<p>
71<code>NAND_RESULT_BUSY</code> is returned and this function call is denied when the queue for accepting requests inside the library is full.
72</p>
73
74<h2>See Also</h2>
75<p>
76<code><a href="./NANDReadDir.html">NANDReadDir</a></code>
77</p>
78
79<H2>Revision History</H2>
80<p>
812007/06/xx The description of the third argument was not sufficient, so it was revised.<br>2006/09/07 Added text about securing memory of a size rounded up to a multiple of 32 bytes.<br>2006/06/16 Initial version.<BR>
82</p>
83
84</body>
85</html>
86