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

   

LeoSpdlMotor

Format
#include <leo.h>

s32 LeoSpdlMotor(LEOCmd *cmdBlock,
   LEOSpdlMode mode, OSMesgQueue *mq) ;
typedef u8 LEOSpdlMode ;
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, please see the "Programming Cautions" section of the N64 Disk Drive Programmer's Guide.

What This Function Does
It controls the drive�s motor and the position of the head. You can specify any of the three following states for the mode:
  • LEO_MOTOR_ACTIVE - The motor is running, the drive is in active mode.
  • LEO_MOTOR_STANDBY - The drive in is standby mode (the motor is spinning and the head is parked (retracted)).
  • LEO_MOTOR_SLEEP - The drive is in sleep mode (the motor is stopped and the head is parked (retracted)).
Nothing needs to be set for the command block (cmdBlock) argument. When this function finishes, an error code is returned to the area pointed to by the mq argument. An error could arise, so the programmer needs to check this error code. Following are some possible errors, their causes, and the actions that should be taken:
  • LEO_ERROR_QUEUE_FULL - There is no more space in the command queue. The queue size should be enlarged. See the LeoCreateLeoManager function for details.
  • LEO_ERROR_COMMAND_TERMINATED - The LeoClearQueue or LeoReset function was issued, so this function (LeoSpdlMotor) was not executed.
  • LEO_ERROR_DEVICE_COMMUNICATION_FAILURE - The main reason for this error is a bad 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. It can be the result when the connector is reconnected. This causes subsequent N64 Disk Drive operations to be unstable. Advise the users to have it reset.
  • LEO_ERROR_MEDIUM_NOT_PRESENT - The disk has not been inserted.
  • LEO_ERROR_MEDIUM_MAY_HAVE_CHANGED - A disk was reinserted after being removed. There is no certainty that the game should be continued by using the newly inserted disk. If this error occurs, call the LeoReadDiskID function to verify the identity of the newly inserted disk.
  • LEO_ERROR_INCOMPATIBLE_MEDIUM_INSTALLED - This error occurs when a disk of an unsupported type is used. It is unlikely that you will encounter this error.
  • LEO_ERROR_LBA_OUT_OF_RANGE - The specified LBA is out of range. All LBAs should be in the range from 0 to 4291.
  • LEO_ERROR_WRITE_PROTECTED (Write only) - The LBA you are attempting to write to is in the unwritable area (ROM area) of the disk, so the writing was not done.
  • LEO_ERROR_DRIVE_NOT_READY - This error occurs when the disk is not operating or when it is not stable.
  • LEO_ERROR_NO_POSITION_FOUND - This error occurs when the servo data cannot be read or when an abnormality is found.
  • LEO_ERROR_DIAGNOSTIC_FAILURE - This error occurs when an abnormality is found in the drive or when it cannot trace.
  • LEO_ERROR_NO_SEEK_COMPLETE - This error occurs when seeking cannot be done due to a seek time out or a trace time out.
  • LEO_ERROR_DATA_PHASE_ERROR - This error occurs when data transmission did not finish in the allotted time.
  • LEO_ERROR_UNRECOVERED_READ_ERROR - This error occurs when the data could not be read clearly because of a flaw on the disk.
  • LEO_ERROR_WRITE_FAULT (Write only) - This error occurs when an abnormality is detected while writing.
  • LEO_ERROR_TRACK_FOLLOWING_ERROR - This error occurs when it the head slips off the track while reading.
The returned value is -1 when Leo Manager has not been created ; 0 when it has.

Error Codes List (Defined in leo.h)
  • LEO_ERROR_NO_SEEK_COMPLETE
  • LEO_ERROR_WRITE_FAULT
  • LEO_ERROR_DRIVE_NOT_READY
  • LEO_ERROR_NO_REFERENCE_POSITION_FOUND
  • LEO_ERROR_DEVICE_COMMUNICATION_FAILURE
  • LEO_ERROR_TRACK_FOLLOWING_ERROR
  • LEO_ERROR_TRACKING_OR_SPDL_SERVO_FAILURE
  • LEO_ERROR_UNRECOVERED_READ_ERROR
  • LEO_ERROR_INVALID_COMMAND_OPERATION_CODE
  • LEO_ERROR_LBA_OUT_OF_RANGE
  • LEO_ERROR_INVALID_FIELD_IN_COMMAND_BLOCK
  • LEO_ERROR_WRITE_PROTECT_ERROR
  • LEO_ERROR_MEDIUM_MAY_HAVE_CHANGED
  • LEO_ERROR_POWERONRESET_DEVICERESET_OCCURED
  • LEO_ERROR_COMMAND_CLEARED_BY_HOST
  • LEO_ERROR_INCOMPATIBLE_MEDIUM_INSTALLED
  • LEO_ERROR_UNKNOWN_FORMAT
  • LEO_ERROR_MEDIUM_NOT_PRESENT
  • LEO_ERROR_DIAGNOSTIC_FAILURE
  • LEO_ERROR_COMMAND_PHASE_ERROR
  • LEO_ERROR_DATA_PHASE_ERROR
  • LEO_ERROR_ABORT
  • LEO_ERROR_INVALID_COMMAND
  • LEO_ERROR_NO_DEVICE
For more information about the errors that may be returned, their causes and ways to deal with them, please see the "Error-Handling" section of the N64 Disk Drive Programmer's Guide.

The return value is -1 if Leo Manager has not been created, and 0 if it has. Usually no check is necessary.

Example
LEOCmd cmdBlock ;
u32 error ;
�..
LeoSpdlMotor (&cmdBlock,
   LEO_MOTOR_ACTIVE, &diskQ) ;
osRecvMesg (&diskQ, (OSMesg *)&error,
   OS_MESG_BLOCK) ;
See Also
Leo
LeoModeSelectAsync
LeoCreateLeoManager
LeoReadWrite
LeoSpdlMotor
LeoByteToLBA
LeoLBAToByte
LeoInquiry
LeoTestUnitReady
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