7.6 Special Functions


Described in this section are special functions that are not commonly used. Use of these functions is accompanied by various restrictions. Please note these restrictions when using the functions.


7.6.1 Setting the Mode Switch Time u

LeoModeSelectAsync ( )function

#include <PR/leo.h>

s32 LeoModeSelectAsync(LEOCmd *cmdBlock, u32 standby,

u32 sleep, OSMesgQueue *mq);

standby   timing of change from active to standby mode

sleep       timing of change from standby to sleep mode

The LeoModeSelect( ) function of previous versions is no longer available. Provided instead is the LeoModeSelectAsync( ) function for asynchronous functions.

The switch times from active mode to standby mode and from standby mode to sleep mode are set using standby and sleep, respectively (units: seconds). The default settings are 3 seconds for standby and 1 second for sleep. That is, if a command that puts 64DD in active mode - such as a read, write, or seek command - is not issued for approximately 3 seconds, 64DD automatically switches to standby mode. If one of these commands is not issued in standby mode for approximately 1 second, 64DD automatically switches to sleep mode. The LeoModeSelectAsync( ) function can change these times. Each can be set to between 0 and 10 seconds in 1-second units.

For more information, on active, standby, and sleep mode, see "7.2.1, Forced Mode Changes."

For information on cmdBlock, or mq, see the description in section "7.2, Asynchronous Functions." The return value is 0 if leo manager is started and -1 if it is not. If the arguments provided for standby and sleep are not between 0 and 10, -1 is returned even if the leo manager is started. In this case, messages are not sent from leo manager as mq, increasing the chance of a message queue hangup by the subsequent function, osRecvMesg(). In programs that specify arguments for standby and sleep via variables rather than by assigning them constants, particular care is required to ensure that the values of these variables are between 0 and 10.

Note: Settings that are excessively high invariably shorten the life of the user's 64DD. Whenever possible, please use the default settings. Settings that are shorter than the default values pose no problems.


7.6.2 Rezeroing

LeoRezero ( ) function

#include <PR/leo.h>

s32 LeoRezero(LEOCmd *cmdBlock, OSMesgQueue *mq);

When a seek is performed for LBA0, the drive's internal register is returned to the initialized state. With typical use, use of this command is unnecessary. A simple seek for LBA0 can be completed more quickly using LeoSeek() .

For information on cmdBlock, or mq, see the description in Section 7.2, "Asynchronous Functions."


7.6.3 Checking the Current Drive Statusu

LeoTestUnitReady ( )function

#include <PR/leo.h>

typedef u8 LEOStatus;

s32 LeoTestUnitReady(LEOStatus *status);

status 64DDstatus

#define LEO_TEST_UNIT_MR 0x01 /* MEDIUM REMOVED */

#define LEO_TEST_UNIT_RE 0x02 /* HEAD RETRACTED */

#define LEO_TEST_UNIT_SS 0x04 /* SPINDLE STOPPED */

Checks the status of the 64DD , and the result is stored in status . When the LEO_TEST_UNIT_MR bit is set, no disk is inserted; when the LEO_TEST_UNIT_RE bit is set, the head is retracted; and when the LEO_TEST_UNIT_SS bit is set, the motor is stopped. Because access through the PI bus is required to execute this command, it cannot be executed if the PI bus is in use. In such cases, LEO_ERROR_BUSY is returned.

Note: Whether a disk has been removed can be determined by issuing a call to one of the asynchronous functions. It is usually not necessary to determine whether the head is retracted or the motor is stopped (i.e. the current status [mode] of the drive). For example, if active mode is desired, switching to this mode can be accomplished directly using the LeoSpdlMotor( ) function. Thus, there are few cases in which the LeoTestUnitReady ( ) command can be used.