NANDReadDirAsync

C Specification


#include <revolution/nand.h>

#define NAND_MAX_NAME          12

typedef void (*NANDCallback)( s32 result, NANDCommandBlock *block );

s32 NANDReadDirAsync( const char *dirName, char *nameList, u32 *num, NANDCallback cb, NANDCommandBlock *block );

Arguments

dirName Name of the directory to read from.
nameList Start address of the buffer used for storing the list of file names and directory names contained in the directory that is read. This buffer must be aligned on a 32-byte address boundary. If set to NULL, the list is not stored in the buffer.
num Stores the number of files and directories contained in the directory that is read.
cb Specifies the callback function to call when this function completes processing.
block Specifies the command block structure to pass to the callback function.

Return Values

Returns NAND_RESULT_OK when the request begins normally.

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

Asynchronously gets the list of file names and directory names contained in the directory that is read. If the list size is unknown, retrieve the list as follows:

  1. Call this function with the second argument set to NULL. The number of elements in the list is written to the location pointed to by num.
  2. Allocate a memory block with the size [ (Number of Elements) x (NAND_MAX_NAME+1)] or larger.
  3. Call this function again with start address of the allocated memory buffer 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.

If the queue receiving the request is full in the library, this function call is refused and NAND_RESULT_BUSY is returned.

See Also

NANDReadDir

Revision History

06/16/2006 Initial version.