N64® Functions Menu

al - Audio Library Functions
gDP - DP GBI Macros
gdSP - General GBI Macros
gSP - SP GBI Macros
gt - Turbo Microcode RDP
gu - Graphics Utilities
Math - Math Functions
nuSys - NuSystem
os - N64 Operating System
sp - Sprite Library Functions
uh - Host to Target IO
64DD - N64 Disk Drive

Nintendo® Confidential

   

LeoTestUnitReady

Format
#include <leo.h>
s32 LeoTestUnitReady(LEOStatus *status);
typedef u8 LEOStatus;
Note
None of the N64 Disk Drive-related instructions involve ROM DMA (including DMA to ROM in the drive). In fact, the instructions are designed on the assumption that ROM DMA will not be carried out. To learn more about this, see Chapter 12 "Programming Cautions" of the N64 Disk Drive Programmer's Guide.

What This Function Does
It Checks the state of the N64 Disk Drive. That is, it checks to if a disk is inserted, if the head is retracted (parked) or down, and if the motor is spinning or stopped. Following is the meaning of each bit returned to the location pointed to by the status argument:
  • LEO_TEST_UNIT_MR means the disk is not inserted.
  • LEO_TEST_UNIT_RE means the head is parked (retracted).
  • LEO_TEST_UNIT_SS means the motor is stopped.
Error codes are returned as return values to the message queue. Check all error codes and take the appropriate measures when the operation does not terminate normally. Following are some possible errors that can be returned, their causes, and the actions that should be taken:
  • LEO_ERROR_BUSY - To check the status of the drive, you must use the PI bus. The LeoTestUnitReady function checks the condition of the PI bus first, and if the PI bus is DMA_BUSY, the function returns this error.
  • LEO_ERROR_QUEUE_FULL - There is no space in the command queue. The queue size should be enlarged. See LeoCreateLeoManager for details.
  • LEO_ERROR_COMMAND_TERMINATED - The LeoClearQueue or LeoReset function was issued, so this function (LeoTestUnitReady) was not executed.
  • LEO_ERROR_DEVICE_COMMUNICATION_FAILURE - The main reason for this error is an improper physical connection. However, there is a possibility that the drive itself is not functioning.
  • LEO_ERROR_COMMAND_PHASE_ERROR - This error occurs when the N64 Disk Drive status is not good.
  • LEO_ERROR_POWERONRESET_DIVICERESET_OCCURED - This error appears when the drive is reset. The possible cause is that the connector was just reconnected. As the N64 Disk Drive operation after that is not stable, you should advise the users to reset it.
  • LEO_ERROR_MEDIUM_NOT_PRESENT - The disk has not been inserted.
  • LEO_ERROR_MEDIUM_MAY_HAVE_CHANGED - A disk was inserted after being removed once. It is uncertain if the game should be continued by using the newly inserted disk. If this error occurs, call LeoReadDiskID and check the newly inserted disk.
Even if such errors as the POWERONRESET_DEVICERESET_OCCURED error, the MEDIUM_NOT_PRESENT error, or the MEDIUM_MAY_HAVE_CHANGED error occur, the function itself is still executed, and the correct value is returned to the location pointed to by the status argument.

Please refer to the "Error-Handling" section of the N64 Disk Drive Programmer's Guide for more information about the types of errors that might be returned, their causes, and the countermeasures to take.

See Also
Leo
LeoCreateLeoManager
LeoReadWrite
LeoSeek
LeoSpdlMotor
LeoByteToLBA
LeoLBAToByte
LeoInquiry
LeoRezero
LeoClearQueue
LeoReadCapacity



Nintendo® Confidential

Warning: all information in this document is confidential and covered by a non-disclosure agreement. You are responsible for keeping this information confidential and protected. Nintendo will vigorously enforce this responsibility.

Copyright © 1998
Nintendo of America Inc. All rights reserved
Nintendo and N64 are registered trademarks of Nintendo
Last updated January 1998