LeoSetRTC LeoSetRTC (function)

LeoReadRTC

Reads the time from the internal RTC

LeoSetRTC

Sets the internal RTC time

Syntax

#include <PR/leo.h>     /* 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;

Description

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 "Chapter 12: Programming Cautions" in the N64 Disk Drive Programming Manual.

The LeoReadRTC and LeoSetRTC functions work with the N64 Disk Drive's internal RTC (real-time clock). The LeoReadRTC function reads the time from the RTC and stores it in the cmdBlock.data.time (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. The "year" is expressed in 4 digits with the high 2 digits being yearhi and low 2 digits being yearlo.

A value for the year that the LeoReadRTC function returns ranges from 1996 to 2095. Also the value that the LeoSetRTC function sets must be in that range. LEO_ERROR_ILLEGAL_TIMER_VALUE error will be returned if a value our of that range is specified. If one second passes by from 23:59:59 12/31/2059, it will be 0:0:0 01/01/1996.

The "hour" member uses the 24-hour clock.

Nothing needs to be set for the command block cmdBlock argument. When processing of this function ends, an error code is returned to the message queue mq. An error could arise, so the programmer needs to check this error code.

For more information about the errors that may be returned, their causes, and ways to deal with them, please see "Chapter 10: Error-Handling" of the N64 Disk Drive Programming Manual.

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;
.....
LeoReadRTC(&cmdBlock, &diskQ);
osRecvMesg(&diskQ, (OSMesg *)&error, OS_MESG_BLOCK);

See Also

Leo*CreateLeoManager,

Revision History

04/30/1999 Changed Format