NANDReadDir

C Specification


#include <revolution/nand.h>

#define NAND_MAX_NAME          12

s32 NANDReadDir(const char *dirName, char *nameList, u32 *num);

Arguments

dirName Directory name.
nameList 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.
num If nameList is NULL, the number of files/directories contained in dirName will be stored in *num. When a buffer address (non-NULL) is given in nameList, file and directory names are written into nameList buffer using the value of *num as the upper limit. The number of files or directories that were actually obtained from dirName is stored in *num.

Return Values

Returns one of the following codes:

NAND_RESULT_OK
NAND_RESULT_ACCESS
NAND_RESULT_ALLOC_FAILED
NAND_RESULT_BUSY
NAND_RESULT_INVALID
NAND_RESULT_NOEXISTS
NAND_RESULT_UNKNOWN
NAND_RESULT_FATAL_ERROR

Description

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.

  1. Call this function with NULL specified as the second argument. The number of elements in the list will be written to the memory region where num points.
  2. Secure a memory region whose size is = (Number of elements) x (NAND_MAX_NAME+1) rounded up to a multiple of 32 bytes.
  3. Call this function again with the allocated memory start address as the second argument.
  4. The number of elements of the list that was retrieved is stored in num (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.

This function may put the current thread to sleep. For precautions when calling similar functions, refer to Interrupts and Callback Functions.

See Also

NANDReadDirAsync, Interrupts and Callback Functions

Revision History

2007/09/25 Added information on the sleep status of threads.
2007/06/xx The description of the third argument was not sufficient, so it was revised.
2006/11/30 Added NAND_RESULT_ALLOC_FAILED and NAND_RESULT_BUSY codes.
2006/09/07 Added text about securing memory of a size rounded up to a multiple of 32 bytes.
2006/06/16 Initial version.


CONFIDENTIAL