LeoReadCapacity LeoReadCapacity (function)

Calculates the usable disk space

Syntax

#include <PR/leo.h>     /* leo.h */

s32 LeoReadCapacity(LEOCapacity *cap, s32 direction);

typedef struct
{
   u32 startLBA;     /* Beginning LBA of usable region */
   u32 endLBA;       /* Ending LBA of usable region */
   u32 nbytes;       /* Total byte size of usable region */
} LEOCapacity;

Description

It calculates the usable disk space. When this function is called with OS_READ placed in the direction argument, "readable starting LBA" is returned in cap->startLBA, "readable ending LBA" is returned in cap->endLBA, and "total readable bytes" is returned in cap->nbytes. These values are usually the same no matter what the type of inserted disk, with startLBA=0, endLBA=4291 and nbytes=64458560.

When this function is called with OS_WRITE placed in the direction argument, "writable starting LBA" is returned in cap->startLBA, "writable ending LBA" is returned in cap->endLBA, and "total writable bytes" is returned in cap->nbytes. The return values vary, depending on the disk types used. Like LeoByteToLBA and LeoLBAToByte, internally stored variables are used for the types of disks inserted. See "7.3.1 Conversion between number of bytes and number of LBA" in the N64 Disk Drive Programming Manual for more information.

The following returned values are possible. A check is usually not necessary.

-1

Leo Manager is not running. The currently inserted disk type is referenced for the conversion operation, so be sure to start Leo Manager before calling this function.

LEO_ERROR_GOOD

Normal termination.

See Also

Leo*CreateLeoManager, LeoByteToLBA, and LeoLBAToByte

Revision History

04/30/1999 Changed Format