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>C Specification</h2>
16<dl><dd><pre><code>
17#include &lt;revolution/nand.h&gt;
18
19#define NAND_MAX_NAME          12
20
21s32 NANDReadDir(const char *dirName, char *nameList, u32 *num);
22</code></pre></dd></dl>
23
24<h2>Arguments</h2>
25<p>
26<TABLE border="1" >
27  <tr>
28<TD valign="top" width="120" bgcolor="#ffffe8"><CODE><STRONG><EM>dirName</EM></STRONG></CODE></TD>
29<TD width="520">Directory name.</TD>
30  </tr>
31  <tr>
32<TD valign="top" width="120" bgcolor="#ffffe8"><CODE><STRONG><EM>nameList</EM></STRONG></CODE></TD>
33<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>
34  </tr>
35  <tr>
36<TD valign="top" width="120" bgcolor="#ffffe8"><CODE><STRONG><EM>num</EM></STRONG></CODE></TD>
37<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>. When a buffer address (non-NULL) is given in <code>nameList</code>, file and directory names are written into <code>nameList</code> buffer using the value of <code>*num</code> as the upper limit. The number of files or directories that were actually obtained from <code>dirName</code> is stored in <code>*num</code>.</TD>
38  </tr>
39</TABLE>
40</p>
41
42<h2>Return Values</h2>
43<p>
44Returns one of the following codes:
45<p>
46<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>
47</p>
48</p>
49
50<H2>Description</H2>
51<p>
52Gets a list of files and directories contained in the specified directory. If the list size is unknown, retrieve the list using the following steps.
53<ol>
54<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 where <STRONG><EM><CODE>num</CODE></EM></STRONG> points.
55<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>
56<li>Call this function again with the allocated memory start address as the second argument.
57<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.
58</ol>
59</p>
60
61<p>
62This 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>.
63</p>
64
65<h2>See Also</h2>
66<p>
67<code><a href="./NANDReadDirAsync.html">NANDReadDirAsync</a></code>, <a href="../os/Interrupt/intro.html">Interrupts and Callback Functions</a>
68</p>
69
70<H2>Revision History</H2>
71<p>
722007/09/25 Added information on the sleep status of threads.<br>2007/06/xx The description of the third argument was not sufficient, so it was revised.<br>2006/11/30 Added <CODE>NAND_RESULT_ALLOC_FAILED</CODE> and <CODE>NAND_RESULT_BUSY</CODE> codes.<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>
73</p>
74
75<hr><p>CONFIDENTIAL</p></body>
76</html>
77