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

   

LeoReadRTC
LeoSetRTC

Format
#include <leo.h>

s32 LeoReadRTC (LEOCmd *cmdBlock,
   OSMesgQueue *mq) ;
s32 LeoSetRTC (LEOCmd *cmdBlock,
   LEODiskTIme *RTCdata,
   OSMesgQueue *mq) ;

typedef struct
{
     u8 pad;
     u8 yearhi;
     u8 yearlo;
     u8 month;
     u8 day;
     u8 hour;
     u8 minute;
     u8 second;
} LEODiskTime;
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
The LeoReadRTC and LeoSetRTC functions work with the N64 Disk Drive�s internal RTC (real-time clock). The LeoReadRT function reads the time from the RTC and stores it in the LEODiskTime structure). The LeoSetRTC function sets the RTC with the time specified by the RTCData argument.

The LEODiskTime structure members are all expressed in BCD notation. The "year" member follows the Western calendar. Note that the first two digits can be neither set nor read. The "hour" member uses the 24-hour clock.

Nothing needs to be set for the command block (cmdBlock argument). When processing of this function is completed, 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. The following are some possible errors that can be returned, their causes, and the actions that should be taken.
  • LEO_ERROR_QUEUE_FULL - There is no space left 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 the RTC function did not execute.
  • 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_DEVICERESET_OCCURED - This error appears when the drive is reset. The possible cause is that the connector was reconnected, which causes subsequent N64 Disk Drive actions to be unstable. Advise the users to reset it.
  • LEO_ERROR_MEDIUM_MAY_HAVE_CHANGED - A disk was inserted after being removed once. It is uncertain if the game should continue with the newly inserted disk. If this error occurs, call LeoReadDiskID to check the identity of the newly inserted disk.
  • LEO_ERROR_REAL_TIME_CLOCK_FAILURE (LeoReadRTC only) - Either the RTC clock has stopped or the battery is low.
  • LEO_ERROR_ILLEGAL_TIMER_VALUE (LeoSetRTC only) - This error is caused by either a mistake in the use of commands or RTC trouble.
The returned value is -1 if Leo Manager hasn't been started, 0 if it has.

For more information about possible errors, their causes, and ways to deal with them, please see the "Error-Handling" section of the N64 Disk Drive Programmer's Guide.

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