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>NANDReadDir</title>
9</head>
10
11<body>
12
13<h1>NANDReadDir</h1>
14
15<h2>Syntax</h2>
16<dl><dd><pre class="construction">#include &lt;revolution/nand.h&gt;
17
18#define NAND_MAX_NAME          12
19
20s32 NANDReadDir(const char *dirName, char *nameList, u32 *num);
21</pre></dd></dl>
22
23<h2>Arguments</h2>
24<p>
25<TABLE class="arguments" border="1" >
26  <tr>
27<TH>dirName</TH>
28<TD>Directory name.</TD>
29  </tr>
30  <tr>
31<TH>nameList</TH>
32<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>
33  </tr>
34  <tr>
35<TH>num</TH>
36<TD>When <SPAN class="argument">nameList</SPAN> is <CODE>NULL</CODE>, the number of files and directories contained in <SPAN class="argument">dirName</SPAN> will be stored in <SPAN class="argument">*num</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>
37  </tr>
38</TABLE>
39</p>
40
41<h2>Return Values</h2>
42<p>
43Returns one of the following codes.
44<p>
45<code>
46NAND_RESULT_OK<br>
47NAND_RESULT_ACCESS<br>
48NAND_RESULT_ALLOC_FAILED<br>
49NAND_RESULT_BUSY<br>
50NAND_RESULT_INVALID<br>
51NAND_RESULT_NOEXISTS<br>
52NAND_RESULT_UNKNOWN<br>
53NAND_RESULT_FATAL_ERROR<br>
54</code>
55</p>
56</p>
57
58<H2>Description</H2>
59<p>
60Gets a list of files and directories contained in the specified directory. If the list size is unknown, retrieve the list using the following steps.
61<ol>
62<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>.
63<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>
64<li>Call this function again with the allocated memory start address as the second argument.
65<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.
66</ol>
67</p>
68
69<p>
70This function may put the current thread to sleep. For precautions when calling similar functions, refer to <a href="../os/Interrupt/intro.html">Interrupts and Callback Functions</a>.
71</p>
72
73<h2>See Also</h2>
74<p class="reference">
75<a href="./NANDReadDirAsync.html">NANDReadDirAsync</a>,
76<a href="../os/Interrupt/intro.html">Interrupts and Callback Functions</a>
77</p>
78
79<H2>Revision History</H2>
80<p>
812007/09/25 Added information about the sleep status of threads.<br>2007/06/xx The description of the third argument was revised because it was insufficient.<br>2006/11/30 Added the <CODE>NAND_RESULT_ALLOC_FAILED</CODE> and <CODE>NAND_RESULT_BUSY</CODE> codes.<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>
82</p>
83
84<hr><p>CONFIDENTIAL</p></body>
85</html>